Let's say I have a docker container running some application, that will sometimes write some data to a file in a folder, that is not mapped to the host. Given the host is shut down in an ungraceful way (like power cables pulled out), what happens to the files that are stored inside the container but not mapped to the host? Will they persist? Does it get removed?
The files are deleted. Containers are ephemeral in nature. When the container starts it creates a new writable layer on top of the image, and whatever changes you make are on that layer. If you are not storing/mapping that layer data to some persistent location, then once the container or Docker daemon or host machine restarts all the data is lost.
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