Revert a Docker container back to its original image without restarting it? Revert a Docker container back to its original image without restarting it? docker docker

Revert a Docker container back to its original image without restarting it?


Sadly while it's running you won't be able to revert or change the image. You'll need to stop your running containers and remove them. Once your volumes are no longer attached to any containers, running the command docker volume prune will destroy all volumes not currently attached to containers.

Then you can simply restart your docker containers from the images, and you'll have a fresh start again.

I also found this article to be a great reference when I was learning docker: https://web.archive.org/web/20190528002402/https://medium.com/the-code-review/top-10-docker-commands-you-cant-live-without-54fb6377f481


To revert back to the original state, you have to restart the container - this is important because a container image is just a bunch of files, the actual running container must start some process and because of that, you cannot revert the container while running, since that process will most likely have issues.

So to answer your question - restart the container, a docker image only takes milliseconds to start up - the rest of the time is the process starting up.


Do not mount a volume to the container. Volumes, whether a data or a fs mount are persistent. If you do not persist the data you can then go docker restart my container.