After I exit the shell everything that I do inside a container is lost. Is it possible to make it save its state beyond the environment defined by its image?
Simple test: write FROM ubuntu inside a Dockerfile then create the image with:
docker build -t test .
Get the image with: docker image ls, then create and run the container:
docker run -d -ti imageid /bin/bash
Once inside, touch /opt/test.txt then exit the shell. What magic would make it possible to see the test file again once a container finished, without touching its image? Or is it exactly the point of containers to never save their state past their image?
Note that I want to avoid mounting local directories, my question is not about how to save data processed by a container, but about saving the filesystem of a container once it finished, beyond its actual image. What if you want to use a development container in order to build its image properly for example? You start working on the container, install some software, do tests, then you have to close it for some time and then "boot" back into it to continue working...