Heim  >  Fragen und Antworten  >  Hauptteil

docker有了本地镜像源,创建的时候还是去pull呢?

root@docker_01 ~]# docker images
REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
hub.c.163.com/public/centos   6.7-tools           b2ab0ed558bb        6 weeks ago         601.9 MB
hub.c.163.com/public/centos   7.0                 2ce04a284fa8        9 months ago        287.9 MB
hub.c.163.com/public/centos   latest              997f0ed97903        13 months ago       441.8 MB
[root@docker_01 ~]# docker run --name ceshi -it centos 
Unable to find image 'centos:latest' locally
Trying to pull repository docker.io/library/centos ... 

。。。这是为何? 我按照下面的方法进入。。。

[root@docker_01 ~]# docker ps -a
CONTAINER ID        IMAGE                                   COMMAND                  CREATED             STATUS              PORTS               NAMES
98a498cff145        hub.c.163.com/public/centos:6.7-tools   "/usr/bin/supervisord"   3 minutes ago       Up 3 minutes        22/tcp              ceshi_2
[root@docker_01 ~]# sh d.sh 98a498cff145
3396
[root@98a498cff145 ~]# ls
anaconda-ks.cfg  d.sh  new.file
[root@98a498cff145 ~]# exit 
logout
[root@docker_01 ~]# ls
anaconda-ks.cfg  d.sh  new.file

[root@docker_01 ~]# cat d.sh 
#!/bin/bash
PID=$(docker inspect --format "{{.State.Pid}}" $1)
echo $PID
nsenter -t $PID -u -i -n -p

为什么物理系统和容器里面的文件都是一样的?。。。。

天蓬老师天蓬老师2704 Tage vor976

Antworte allen(1)Ich werde antworten

  • ringa_lee

    ringa_lee2017-04-27 09:05:46

    你REPOSITORY下没有叫centos的镜像。而是叫hub.c.163.com/public/centos 。所以他会去拉去centos 最新的版本

    docker run --name ceshi -it hub.c.163.com/public/centos

    Antwort
    0
  • StornierenAntwort