Tag: Dockerfile

  • Create Dockerfile From Image

    Create Dockerfile From Image

    If you have a docker image and don’t have the Dockerfile used to create the image, dfimage can help you re-create Dockerfile. To find information about an image, you can use the command “docker history IMAGE_ID”. History command will show all actions taken on the image, including the commands used. You can use this information to reverse engineer and create the missing Dockerfile.

    There is a tool for automating this task, it is called dfimage. It is available on the docker hub.

    https://hub.docker.com/r/laniksj/dfimage

    To use it, run

    docker pull laniksj/dfimage
    docker run -v /var/run/docker.sock:/var/run/docker.sock  --rm laniksj/dfimage IMAGE_ID
    

    In the above command, replace IMAGE_ID with image ID of the docker image for which you need Dockerfile created.

    Example

    docker run -v /var/run/docker.sock:/var/run/docker.sock  --rm laniksj/dfimage  4a7a1f401734
    

    See Docker