Docker:如何访问图像的Dockerfile?

当我运行the command docker images我得到如下所示的列表。

[root @ hadoop01 myjavadir]#泊坞窗图像

 REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE runhelloworld latest c49c32235334 18 hours ago 642.2 MB <none> <none> 6eadaac27986 19 hours ago 642.2 MB <none> <none> ed95cf58873e 25 hours ago 642.2 MB <none> <none> ebedbfee37fd 25 hours ago 642.2 MB <none> <none> 25453e89b3f0 43 hours ago 0 B priyankapatil/docker-whale latest aa043d321de5 44 hours ago 255.5 MB helloworld latest aa043d321de5 44 hours ago 255.5 MB docker-whale latest aa043d321de5 44 hours ago 255.5 MB java latest 3323938eb5a2 9 days ago 642.2 MB tomcat7 dockerfile 4b4b09c0dbed 9 days ago 1.289 GB tomcat7 dockerfile1 4b4b09c0dbed 9 days ago 1.289 GB tomcat7 latest 4b4b09c0dbed 9 days ago 1.289 GB docker_image latest 4b4b09c0dbed 9 days ago 1.289 GB lastest_docker latest 4b4b09c0dbed 9 days ago 1.289 GB tapash1 latest 4b4b09c0dbed 9 days ago 1.289 GB <none> <none> 866c370a7562 9 days ago 855.3 MB <none> <none> 8ca0c468c6ee 9 days ago 598.8 MB <none> <none> d5f676fa467b 9 days ago 292.5 MB <none> <none> 459c1c0551e2 9 days ago 265.6 MB registry 2 1fff2b77d9b3 3 weeks ago 224.5 MB centos latest 60e65a8e4030 6 weeks ago 196.6 MB hello-world latest 975b84d108f1 4 months ago 960 B centos centos6 3bbbf0aca359 4 months ago 190.6 MB docker/whalesay latest fb434121fc77 8 months ago 247 MB 

我怎样才能访问这个列表中的图像的dockerfile?

从centurylinklabs的图像中看到dockerfile

https://github.com/CenturyLinkLabs/dockerfile-from-image

docker history

在图像上会给你主要的信息,请参阅文档

https://docs.docker.com/engine/reference/commandline/history/

我写了这个简短的Python脚本,它比dockerfile-from-imageless一点

 import subprocess import sys def main(): dockid = sys.argv[1] args = ['docker', 'history', dockid] proc = subprocess.Popen(args=args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) (stdout, stderr) = proc.communicate() lines = stdout.split('\n')[1:-2] lines.reverse() for line in lines: idlayer = line.split(' ')[0] args = ['docker', 'inspect', "--format", "'{{ ((index .ContainerConfig.Cmd ) 0) }}'", idlayer] proc = subprocess.Popen(args=args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) (stdout, stderr) = proc.communicate() print stdout, # print idlayer, stdout, main()