一、概念
Image可以看做是一类,而Container则为基于类的实例化
二、容器操作
1、列出正在运行的容器
docker container ls
2、列出所有容器,包括已退出运行的
docker container ls -a
简化命令 :docker ps -a
3、交互式运行容器
[docker@localhost hello-world]$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
zheng007/hello-world latest c546aefca549 15 minutes ago 844kB
python 2.7 0313c3892dbc 7 days ago 912MB
hello-world latest fce289e99eb9 7 weeks ago 1.84kB
centos latest 1e1148e4cc2c 2 months ago 202MB
[docker@localhost hello-world]$ docker run -it centos
[root@72e4d7a2a549 /]# ls
anaconda-post.log bin dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
便可以在容器内进行操作
4、docker 命令分为两大块,Management Commands和Commands
5、删除容器
docker container rm [container ID]
docker rm $(docker container ls -aq) #删除所有的容器
docker rm $(docker container ls -f "status=exited") #删除已退出的容器