docker search
docker pull
docker images
docker rmi
docker run ubuntu echo "hello world" // 这个执行完任务容器就退出了
hello world
docker ps -a
- 启动交互式容器
--name mydocker1 自定义容器名称
-i --interactive=true|false
-t --tty=true|false
hejings-iMac:~ hejing$ docker run --name mydocker1 -i -t ubuntu /bin/bash
root@811d29f17b64:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@811d29f17b64:/# ll
total 72
drwxr-xr-x 1 root root 4096 Dec 21 04:47 ./
drwxr-xr-x 1 root root 4096 Dec 21 04:47 ../
-rwxr-xr-x 1 root root 0 Dec 21 04:47 .dockerenv*
drwxr-xr-x 2 root root 4096 Dec 1 21:53 bin/
drwxr-xr-x 2 root root 4096 Apr 12 2016 boot/
drwxr-xr-x 5 root root 360 Dec 21 04:47 dev/
drwxr-xr-x 1 root root 4096 Dec 21 04:47 etc/
drwxr-xr-x 2 root root 4096 Apr 12 2016 home/
drwxr-xr-x 8 root root 4096 Sep 13 2015 lib/
drwxr-xr-x 2 root root 4096 Dec 1 21:53 lib64/
drwxr-xr-x 2 root root 4096 Dec 1 21:52 media/
drwxr-xr-x 2 root root 4096 Dec 1 21:52 mnt/
drwxr-xr-x 2 root root 4096 Dec 1 21:52 opt/
dr-xr-xr-x 128 root root 0 Dec 21 04:47 proc/
drwx------ 2 root root 4096 Dec 1 21:53 root/
drwxr-xr-x 1 root root 4096 Dec 1 21:53 run/
drwxr-xr-x 1 root root 4096 Dec 14 20:59 sbin/
drwxr-xr-x 2 root root 4096 Dec 1 21:52 srv/
dr-xr-xr-x 13 root root 0 Dec 21 04:47 sys/
drwxrwxrwt 2 root root 4096 Dec 1 21:53 tmp/
drwxr-xr-x 1 root root 4096 Dec 1 21:52 usr/
drwxr-xr-x 1 root root 4096 Dec 1 21:53 var/
root@811d29f17b64:/# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 18240 3324 pts/0 Ss 04:47 0:00 /bin/bash
root 13 0.0 0.1 34424 2868 pts/0 R+ 04:51 0:00 ps aux
root@811d29f17b64:/#
docker start -i mydocker1
docker rm db5acb947216 //db5acb947216 容器ID
网友评论