-1

I know that I can pull a docker image locally and use docker image inspect to get details about the image details in the ContainerConfig section.

I am looking for a way to get the Dockerfile of an image hosted in Docker Hub without pulling the image locally.

For example, consider this image:

https://hub.docker.com/r/kodekloud/throw-dice

How can I see its Dockerfile without pulling its image locally?

Allan Xu
  • 7,998
  • 11
  • 51
  • 122

1 Answers1

0

On Docker Hub, if you click on "Tags" and then a specific tag (for this particular image, only "latest" exists) then you'll get an automated dump of the layer metadata, which is sort of like a Dockerfile. Some details, like the original file names from the build context, are lost.

In general you can only approximately reconstruct the Dockerfile given an image. I've had reasonably good luck finding corresponding GitHub repositories, and a Dockerfile is usually in the repository root or in a directory with an obvious name like docker.

David Maze
  • 130,717
  • 29
  • 175
  • 215