Persistent data storage

Because applications are run inside a Docker container, data written anywhere else than a persistent data storage is lost when application is closed. The persistent data storage is a mapped directory to the normal filesystem on the host operating system and is called volume. The volume can be accessed inside the container using /volume as path. The volume is also used for storing the application directory content when installing application packages. Applications files and directories are therefore in /volume/application.

Notice! Every change made to /volume/application directory is persistent but it is not adviced to actually store any application data there. This is because the /volume/application directory is subject to deletion for example when application is updated. Store all data directly to /volume or subdirectories of it. It is quaranteed that any application data survives updates etc. in this way.

A Node.js example of writing data to the /volume directory.

fs.writeFile("/volume/greetings/message.txt", "Hello, Spaceify!", function (err) {} });
copyright © 2014