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!
The raw output, as described in "How to generate a Dockerfile from an image?", would be:
docker history --no-trunc <IMAGE_ID>
But a more complete output would be from CenturyLinkLabs/dockerfile-from-image
docker run -v /var/run/docker.sock:/var/run/docker.sock \
centurylink/dockerfile-from-image <IMAGE_TAG_OR_ID>
Note there were limitations.
In 2020, as illustrated here:
docker run -v /var/run/docker.sock:/var/run/docker.sock --rm alpine/dfimage \
-sV=1.36 <IMAGE_TAG_OR_ID>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With