How to show a dockerfile of image docker

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!

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

If you’re just looking for examples, Docker Official Images · GitHub has the sources for several of the official images.

1 Like

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!