一、镜像拉取中的点
pull kiwenlau/hadoop:1.0下来,可以发现pull会拉下很多层镜像
docker pull kiwenlau/hadoop:1.0

完全pull下来的之后,我们如果使用
docker images
只能查看到最终的镜像
使用
docker images -a
命令的话,可以把中间层镜像都查出来
可以使用
docker history kiwenlau/hadoop:1.0
命令来看看,可以发现kiwenlau/hadoop:1.0包含很多个镜像层,Dockerfile有多少条命令,就有多少个镜像层……(docker history : 查看指定镜像的创建历史。--no-trunc=true :显示完整的提交记录。)
二、根据pull下来的镜像反推docker文件
1、使用命令
docker run --rm -v '/var/run/docker.sock:/var/run/docker.sock' lukapeschke/dfa <IMAGE_ID>

2、使用docker history指令,显示是反着的……
docker history kiwenlau/hadoop:1.0 --no-trunc=true

三、使用github上项目源码文件包中dockerfile文件构建镜像与直接拉取的镜像对比
github上项目源码文件 kiwenlau/hadoop-cluster-docker——Dockerfile
直接拉取镜像:docker pull kiwenlau/hadoop:1.0
构建成功
网友评论