Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker - How to get the name (user/repo:tag) of the base image used to build another image

When I run docker history mysql the last line is:

104de4492b99  9 days ago  /bin/sh -c #(nop) ADD file:f35a56605b9a065a14 4.97 MB

I wanted to know what base image the id f35a56605b9a065a14 corresponds to, so I found the mysql Dockerfile on Github. The first line is:

FROM debian:wheezy

1) Can someone confirm that f35a56605b9a065a14 is indeed the id of the debian:wheezy base image?

2) If I didn't have access to the Dockerfile, how would I go about making the connection that f35a56605b9a065a14 corresponds to debian:wheezy?

Thanks

like image 786
el_tigro Avatar asked Jun 30 '15 22:06

el_tigro


1 Answers

When you just have an image and want to recreate the Dockerfile, you can use dockerfile-from-image from

https://github.com/CenturyLinkLabs/dockerfile-from-image/blob/master/dockerfile-from-image.rb

it is some Ruby code (in a container, of course!) that find all the commands used.

And, yes f35... is the id of DEBIAN:WHEEZY, as

docker run -v /var/run/docker.sock:/var/run/docker.sock centurylink/dockerfile-from-image debian:wheezy

shows

ADD file:f35a56605b9a065a14a18d0e36fdf55c1c381d3521b4fa7f11173f0025d36839 in / CMD ["/bin/bash"] `

like image 187
user2915097 Avatar answered Oct 10 '22 18:10

user2915097