docker 公共命令
docker version
docker info
docker --help
systemctl start docker
systemctl stop docker
systemctl restart docker
镜像images操作
docker search mysql
docker pull mysql
docker pull mysql:5.7
docker images
-a, --all
-q, --quiet
docker rmi redis
docker rmi -f redis
容器的操作
docker run [可选参数] image
--name="name" 容器名字,用来区分不同的容器
-d 以后台进程启动
-it 使用交互式方式启动,直接进入容器内部
-p 指定容器的端口
-p 主机端口:容器端口 常用
-p 容器端口
-P 指定随机端口(大写)
[root@instance-xrx1ekbd ~]
[root@15fb42080876 /]
bin dev etc home lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var
[root@15fb42080876 /]
[root@instance-xrx1ekbd ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
15fb42080876 centos "/bin/bash" About a minute ago Up About a minute awesome_mclean
[root@instance-xrx1ekbd ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
15fb42080876 centos "/bin/bash" 2 minutes ago Exited (0) 7 seconds ago awesome_mclean
78529ee8eb85 hello-world "/hello" 3 days ago Exited (0) 3 days ago crazy_easley
exit
ctrl + p + q
docker stop 容器id
docker start 容器id
docker restart 容器id
docker kill 容器id
docker rm 容器id
docker rm -f $(docker ps -aq)
docker rm -a -q|xargs docker rm