Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check which version docker image is built upon

Tags:

docker

I have a docker image sitting in Artifactory. How to check what is "base image version is"?

e.g. My dockerimage in artifactory created based on docker file like this

FROM test-image:v1.0.0
...

Now after the build, how can i find that this image is built on v1.0.0

I tried doing docker inspect <imagename> it didn't help me to find the version of test-image. Is there anyway I can find this version?

like image 476
change198 Avatar asked Oct 31 '25 10:10

change198


1 Answers

You can use docker image history to see filesystem layers that the image consists of.

For example, assuming that you have image called app.

docker image history app

the result will look something like this.

IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
7a85c25a7a6b        3 hours ago         /bin/sh -c #(nop)  CMD ["node" "index.js"]      0B                  
339d3cb45826        3 hours ago         /bin/sh -c #(nop) COPY dir:15f5040b90b2035eb…   471B                
d7c2ba41aed4        8 days ago          /bin/sh -c #(nop) WORKDIR /node/app             0B                  
da8751259bd7        8 days ago          /bin/sh -c #(nop)  EXPOSE 5000                  0B                  
25d4e098fa1b        8 days ago          /bin/sh -c #(nop)  ENV PORT=5000                0B                  
0e2e78467169        5 weeks ago         /bin/sh -c #(nop)  CMD ["node"]                 0B                  
<missing>           5 weeks ago         /bin/sh -c #(nop)  ENTRYPOINT ["docker-entry…   0B                  
<missing>           5 weeks ago         /bin/sh -c #(nop) COPY file:238737301d473041…   116B                
<missing>           5 weeks ago         /bin/sh -c set -ex   && savedAptMark="$(apt-…   9.58MB              
<missing>           5 weeks ago         /bin/sh -c #(nop)  ENV YARN_VERSION=1.22.4      0B                  
<missing>           5 weeks ago         /bin/sh -c ARCH= && dpkgArch="$(dpkg --print…   100MB               
<missing>           5 weeks ago         /bin/sh -c #(nop)  ENV NODE_VERSION=14.4.0      0B                  
<missing>           5 weeks ago         /bin/sh -c groupadd --gid 1000 node   && use…   333kB               
<missing>           5 weeks ago         /bin/sh -c #(nop)  CMD ["bash"]                 0B                  
<missing>           5 weeks ago         /bin/sh -c #(nop) ADD file:57b431451a292755d…   55.3MB 

Look at the IMAGE column and the entry that is right above the first <missing>, in this case - 0e2e78467169. That is the ID of the image that the new image has been built from. Now you can list all images and find the corresponding one.

docker image ls | grep 0e2e78467169

Example output:

node                         14-stretch-slim     0e2e78467169        5 weeks ago         165MB

this (node:14-stretch-slim) is the image I used to build the new one from.

like image 148
Matus Dubrava Avatar answered Nov 03 '25 01:11

Matus Dubrava