When I run the command docker images
I get the list as shown below.
[root@hadoop01 myjavadir]# docker images
REPOSITORY
see dockerfile from image from centurylinklabs
https://github.com/CenturyLinkLabs/dockerfile-from-image
docker history
on an image will give you the main information, see the doc
https://docs.docker.com/engine/reference/commandline/history/
I had written this short Python script which does a little less than 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()