当我运行the command docker images
时,我会得到如下所示的列表。
[root @ hadoop01 myjavadir] #docker images
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?
答案 0 :(得分:1)
从centurylinklabs的图片中查看dockerfile
https://github.com/CenturyLinkLabs/dockerfile-from-image
docker history
将为您提供主要信息,请参阅文档
https://docs.docker.com/engine/reference/commandline/history/
我写过这个简短的Python脚本,它比dockerfile-from-image
少一点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()