docker有了本地镜像源,创建的时候还是去pull呢?
天蓬老师
天蓬老师 2017-04-27 09:03:46
0
1
1047
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

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

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(1)
左手右手慢动作

There is no image called centos under your REPOSITORY. Instead, it's called hub.c.163.com/public/centos. So he will pull the latest version of centos

docker run --name ceshi -it hub.c.163.com/public/centos
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template