Docker Apps need to store their data outside of the container. Otherwise the data is lost as soon as the container is removed.

+

+

For [[Docker Apps/Image Based]], this happens on every update!

+

+

For [[Docker Apps/Package Based]], this happens during updates when the DockerImage in the ini file changes. This is rather uncommon, updates are normally done by installing updated packages from a newer repository.

+

+

But in both cases, the container is removed when the App is uninstalled.

+

+

Data that should survive such an image removal / exchange, needs to be stored either in a shared volume or on a different location (e.g., in a database on the Docker Host).

+

+

= Volumes =

+

+

[[Docker Apps/Files]] shows directories that are always mounted into the container. They can be used store data that shall survive. Either by configuring the App's directories to point to these directories directly, or by copying important data in the store_data script (See [[Docker Apps/Container Scripts]]).

+

+

You can also add other volumes by extending the App's ini file.

+

<pre>

+

DockerVolumes=/opt/myapp/data,opt/myapp/config

+

</pre>

+

This volumes will be mounted into the container as stated (i.e., with docker create -v ...)

+

+

= Database =

+

+

Another way of keeping data is through a database that does not run inside the container, but instead on the Docker Host. This is described in [[Integration with UCS/Database]].

Revision as of 11:51, 11 October 2016

Docker Apps need to store their data outside of the container. Otherwise the data is lost as soon as the container is removed.

For Docker Apps/Package Based, this happens during updates when the DockerImage in the ini file changes. This is rather uncommon, updates are normally done by installing updated packages from a newer repository.

But in both cases, the container is removed when the App is uninstalled.

Data that should survive such an image removal / exchange, needs to be stored either in a shared volume or on a different location (e.g., in a database on the Docker Host).

Volumes

Docker Apps/Files shows directories that are always mounted into the container. They can be used store data that shall survive. Either by configuring the App's directories to point to these directories directly, or by copying important data in the store_data script (See Docker Apps/Container Scripts).

You can also add other volumes by extending the App's ini file.

DockerVolumes=/opt/myapp/data,opt/myapp/config

This volumes will be mounted into the container as stated (i.e., with docker create -v ...)

Database

Another way of keeping data is through a database that does not run inside the container, but instead on the Docker Host. This is described in Integration with UCS/Database.