Docker Community Forums

Share and learn in the Docker community.

How to show a dockerfile of image docker

docker

(Cmardonespino) #1

I download a image from docker repository and Im trying to display the Dockerfile of ‘X’ image to create my own Dockerfile with the same structure to experiment with him. Im using this command:

docker inspect --format=’{{.Config.Image}}’ ‘here paste the id of image’

That command return a ‘sha256’, some like this:

sha256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

but I need a command to display a json file with configuration of Dockerfile. Someone know how can I do this? Sorry if the format or the question is not ok, Im a beginner!

Thanks everyone!


(David Maze) #2

This isn’t possible in general. docker history is the closest thing in the standard toolset.

If you’re just looking for examples, https://github.com/docker-library has the sources for several of the official images.


(Cmardonespino) #3

This isn’t possible in general. docker history is the closest thing in the standard toolset.

If you’re just looking for examples, https://github.com/docker-library1 has the sources for several of the official images.

Hi David,

Thanks so much for your clarification and link of repository. That was too helpful!