Docker Community Forums

Share and learn in the Docker community.

Docker Image edit


(Kirasakuya) #1

Hi guys,
how can I edit a Docker IMAGE, after I have already generated by Dockerfile?
Is it possible ever after?
Is there a command in Linux?

Thanks


(David Maze) #2

Edit the Dockerfile and docker build a new image. Depending on what you’re changing and how your Dockerfile is laid out, the build step might be able to skip (reuse) many of the earlier steps (layers); as a corollary, structuring the Dockerfile so that the things that are most likely to change will be at the end will result in faster rebuilds.


(Nicolas Bihan) #3

You can also run the image, execute bash in an interactive session (that means the main image needs to have Bash installed)
docker exec -it mycontainer bash
Then do your modifications like removing file, installing packages,…
Then you can commit the container as a new image
See this tutorial for full explanation
https://docs.docker.com/engine/tutorials/dockerimages/