Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out the base image for a docker image

Tags:

docker

I have a docker image and I would like to find out from which image it has been created. Of course there are multiple layers, but I'd like to find out the last image (the FROM statement in the dockerfile for this image)?

I try to use docker image history and docker image inspect but I can't find this information in there.

I tried to use the following command but it gives me a error message

alias dfimage="sudo docker run -v /var/run/docker.sock:/var/run/docker.sock --rm xyz/mm:9e945ff" dfimage febae8978318 

This is the error message I'm getting

container_linux.go:235: starting container process caused "exec: \"febae8978318\": executable file not found in $PATH" /usr/bin/docker-current: Error response from daemon: oci runtime error: container_linux.go:235: starting container process caused "exec: \"febae8978318\": executable file not found in $PATH". 
like image 930
HHH Avatar asked Sep 19 '19 20:09

HHH


People also ask

What is the base docker image?

A base image is the image that is used to create all of your container images. Your base image can be an official Docker image, such as Centos, or you can modify an official Docker image to suit your needs, or you can create your own base image from scratch. Parent topic: Docker.

How do I find the default docker image?

If you use the default storage driver overlay2, then your Docker images are stored in /var/lib/docker/overlay2 . There, you can find different files that represent read-only layers of a Docker image and a layer on top of it that contains your changes.

Does docker image include base image?

A Docker image has many layers, and each image includes everything needed to configure a container environment -- system libraries, tools, dependencies and other files. Some of the parts of an image include: Base image. The user can build this first layer entirely from scratch with the build command.

Which base image would you use when compiling the docker image?

You can use Docker's reserved, minimal image, scratch , as a starting point for building containers. Using the scratch “image” signals to the build process that you want the next command in the Dockerfile to be the first filesystem layer in your image.


1 Answers

Easy way is to use

docker image history deno 

This above command will give you output like this

enter image description here

Then just look at the IMAGE column and take that image ID which a24bb4013296 which is just above the first <missing>

Then just do the

For Linux

docker image ls | grep a24bb4013296 

For Windows

docker image ls | findstr a24bb4013296 

This will give you the base image name

enter image description here

like image 178
Dashrath Mundkar Avatar answered Sep 20 '22 04:09

Dashrath Mundkar