[root@hadoop101 ~]# docker images
执行后发现报错如下:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
按如下操作解决了这个问题:
[root@hadoop101 ~]# systemctl daemon-reload
[root@hadoop101 ~]# sudo service docker restart
Redirecting to /bin/systemctl restart docker.service
[root@hadoop101 ~]# sudo service docker status
[root@hadoop101 ~]# sudo docker run hello-world
[root@hadoop101 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest fce289e99eb9 8 months ago 1.84kB
training/webapp latest 6fae60ef3446 4 years ago 349MB
REPOSITORY :表示镜像的仓库源
TAG :镜像的标签
IMAGE ID :镜像ID
CREATED:镜像创建时间
SIZE:镜像大小
[root@hadoop101 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos latest 67fa590cfc1c 4 weeks ago 202MB
centos 7.2.1511 9aec5c5fe4ba 6 months ago 195MB
hello-world latest fce289e99eb9 8 months ago 1.84kB
training/webapp latest 6fae60ef3446 4 years ago 349MB
同一仓库源可以有多个TAG,代表这个仓库源的不同版本,我们使用REPOSITORY :TAG来定义不同的镜像。
如果你不指定一个镜像的版本标签,例如你只用centos,docker将默认使用centos:latest镜像。
[root@hadoop101 ~]# docker images -a
REPOSITORY TAG IMAGE ID CREATED SIZE
centos latest 67fa590cfc1c 4 weeks ago 202MB
centos 7.2.1511 9aec5c5fe4ba 6 months ago 195MB
hello-world latest fce289e99eb9 8 months ago 1.84kB
training/webapp latest 6fae60ef3446 4 years ago 349MB
[root@hadoop101 ~]# docker images -q
6