Docker Community Forums

Share and learn in the Docker community.

Extracting base image from a docker image


(Radiatejava) #1

Hi Docker community:
Is there a way to extract the base image/layer of a docker image that is built on top of that ?


(David Maze) #2

Run docker history, any of the hex layer IDs it prints are valid image IDs. Getting the name or tag of the base image is harder and basically requires you to already have that base image.


(Radiatejava) #3

When I run ‘docker history mydocker-image’, it gives weird result (age for base images are 292 years) and I do not know which one is the real base image.

[root@pxgrid-103 ~]# docker history mydocker-image
IMAGE CREATED CREATED BY SIZE COMMENT
1218aaa0401f 5 weeks ago /bin/sh -c #(nop) CMD [“python”] 0 B
41e0a117a6c8 292 years ago 136.5 kB
ac709741f2af 292 years ago 0 B
b346847fc450 292 years ago 9.766 MB
0268681db06e 292 years ago 4.035 MB
4bbcd6087c8e 292 years ago 1.638 MB
702a463314c0 292 years ago 2.561 MB
8dc23de3c37e 292 years ago 947.2 kB
bb976e058d68 292 years ago 2.748 MB
74f1f1cd7cf7 292 years ago 1.989 MB
d2c484d71740 292 years ago 10.6 MB
d568750b7af4 292 years ago 20.14 MB
509d15b6c60e 292 years ago 72.47 MB
e5269b91c86b 292 years ago 2.719 MB
76eec4d70323 292 years ago 124.3 kB


(Remi Rampin) #4

Apologies for reviving an old thread, but since I have the exact same question, and this thread shows up on Google, it seemed appropriate.

Now that Docker changed their image/layer format, all that shows up in docker history <image> is a bunch of <missing> image IDs. Is there any hope of getting that image? Or a plumbing command that can assemble an image from a bunch of layers?