Stopping and running Docker container doesn't update Stopping and running Docker container doesn't update docker docker

Stopping and running Docker container doesn't update


Docker containers are meant to be immutable, devoted to running a single, particular process. Images should be built and run and you should not change the content of the container.

So in best practise for production, you would create a new container based on image with your code/updates attached.

Though I am aware there are use cases to modify a running container, it wildly depends on which image you use and how well the resulting container handles live changes (does it cache?).


Where did you modify the HTML file? It seems like the HTML file which is inside the container is not updated.

docker ps command only show the running containers. You can use docker ps -a to see all the containers including stopped containers.


Once a dockerfile is built, it's containt is not mutable anymore.So there are some other paths you could take to reach your goal.

  1. You can rebuild the image and re-run it. (Maybe the best case to put in production)
  2. You can build the image to execute an file that is binded dynamically on your docker run.

To follow the second path:

  1. Write a image to execute your ./index.html without copying it on dockerfile.
  2. docker run -it -v <HTML_LOCAL_PATH>:<HTML_CONTAINER> --rm -d -p 8080:80 --name web webserver