问题描述
root@docker_01 ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEhub.c.163.com/public/centos 6.7-tools b2ab0ed558bb6 weeks ago 601.9 MBhub.c.163.com/public/centos 7.0 2ce04a284fa89 months ago287.9 MBhub.c.163.com/public/centos latest 997f0ed9790313 months ago 441.8 MB
[root@docker_01 ~]# docker run --name ceshi -it centos Unable to find image ’centos:latest’ locallyTrying to pull repository docker.io/library/centos ...
。。。这是为何? 我按照下面的方法进入。。。
[root@docker_01 ~]# docker ps -aCONTAINER IDIMAGE COMMAND CREATED STATUS PORTS NAMES98a498cff145hub.c.163.com/public/centos:6.7-tools '/usr/bin/supervisord' 3 minutes ago Up 3 minutes22/tcp ceshi_2[root@docker_01 ~]# sh d.sh 98a498cff1453396[root@98a498cff145 ~]# lsanaconda-ks.cfg d.sh new.file[root@98a498cff145 ~]# exit logout[root@docker_01 ~]# lsanaconda-ks.cfg d.sh new.file
[root@docker_01 ~]# cat d.sh #!/bin/bashPID=$(docker inspect --format '{{.State.Pid}}' $1)echo $PIDnsenter -t $PID -u -i -n -p
为什么物理系统和容器里面的文件都是一样的?。。。。
问题解答
回答1:你REPOSITORY下没有叫centos的镜像。而是叫hub.c.163.com/public/centos 。所以他会去拉去centos 最新的版本
docker run --name ceshi -it hub.c.163.com/public/centos