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加速器
docker images
来源: