Default case storing data inside the Docker container

In this case, data is only visible inside the Docker containers and is not from the host system. The data is lost if the container is shut down or the Docker host dies. This case mostly works with services that are packaged in Docker containers and are not dependent on persistent data when they return:

$ docker run -it ubuntu:14.04 
root@358b511effb0:/# cd /tmp/ 
root@358b511effb0:/tmp# cat > hello.txt 
hii 
root@358b511effb0:/tmp# ls 
hello.txt 

As seen in the preceding example, the hello.txt file only exists inside the container and will not be persisted once the container dies:

Default case storing data inside the Docker container

Data stored inside ...

Get Troubleshooting Docker now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.