1. Containers are not ephemeral. They have a lifecycle. Data written in the container is persisted to disk and available after the container is stopped and then started again.
2. Processes/files/etc are not locked away as if they don't exist. See `ps aux` on the host. You will see all the processes running. You can inspect the filesystems for each container, etc. There is no magic here.
3. A database crash could cause data corruption inside a container or not. This has nothing to do with the container, and chances of a database crash are not made worse by being in a container.
That said, I would let a volume driver manage persistent storage rather than manually managing this through the host fs... but that's my preference.
--- EDIT ---
Disclaimer: I work at Docker Inc, and am a maintainer on the Docker project.
1. Containers are not ephemeral. They have a lifecycle. Data written in the container is persisted to disk and available after the container is stopped and then started again.
2. Processes/files/etc are not locked away as if they don't exist. See `ps aux` on the host. You will see all the processes running. You can inspect the filesystems for each container, etc. There is no magic here.
3. A database crash could cause data corruption inside a container or not. This has nothing to do with the container, and chances of a database crash are not made worse by being in a container.
That said, I would let a volume driver manage persistent storage rather than manually managing this through the host fs... but that's my preference.
--- EDIT --- Disclaimer: I work at Docker Inc, and am a maintainer on the Docker project.