首页 > 其他 > 详细

Docker学习笔记(2-1)Docker镜像

时间:2017-02-02 17:34:59      阅读:231      评论:0      收藏:0      [点我收藏+]

Docker学习笔记(2-1)Docker镜像

 

Docker镜像:可以简单的理解为一个目录,启动容器时,根据这个镜像目录复制出一个目录,并chroot到这个新目录下,这个目录就成了容器的根文件系统。

 

演示:容器有各自的目录,并存放在宿主机的docker安装目录中!

 

第1个容器-每个容器都有单独的目录

#sudo docker run -i -t 62b7 /bin/bash

系统控制被自动被带进入容器

在容器内,执行

  cd /tmp

  echo hello > hello.txt

  cat hello.txt

exit

 

第2个容器

#sudo docker run -i -t 62b7 /bin/bash

系统控制被自动被带进入容器

在容器内,执行

  cd /tmp

  echo hello > hello.txt

  cat hello.txt

exit

 

docker安装所在的目录

cd /var/lib/docker

ls aufs/mount/758eaxxxxxxxxxxxxxxxxx

chroot aufs/mount/758eaxxxxxxxxxxxxxxxxx

cd /tmp

ls

cat hello.txt

 

# 查看本地有哪些镜像

docker images

镜像id:64个字符,每个id可能对应多条。

镜像repository:镜像tag 唯一标识一个tag。

 

本地registry:通过docker images查看

远程registry:docker search查找,docker pull来拉取。

docker pull redis:2.8.19

 

如果从官方registry拉取镜像速度很慢,可以使用daocloud提供的docker加速器

https://dashboard.daocloud.io/mirror

 

docker images

 

 

 

Docker学习笔记(2-1)Docker镜像

原文:http://www.cnblogs.com/lexiaofei/p/6361342.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!