在你的机器上使用docker pull从Docker Hub下载镜像。
docker pull image1
docker pull image2
然后使用docker history来取得构建这两个容器时运行的命令。
docker history --no-trunc=true image > image1-dockerfile
docker history --no-trunc=true image2 > image2-dockerfile
接下来打开这两个文件,你可以看到每个镜像的命令堆栈。这是因为Docker镜像通过层的方式来构建。即你在Dockerfile中键入的每一个命令所构建的新镜像,都是在之前的命令产生的镜像之上。所以你可以对镜像进行逆向工程。