Difference between revisions of "Docker Apps/Persistent Data"

From Univention Wiki

Jump to: navigation, search
Line 15: Line 15:
 
[[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]]).
 
[[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.
+
You can also add other volumes by extending the App's ini file (see [[Provider Portal/Apps]]), e.g., ''/opt/myapp/data'' and ''opt/myapp/config''
<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 ...)
 
This volumes will be mounted into the container as stated (i.e., with docker create -v ...)
  

Revision as of 14:53, 20 December 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/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 (see Provider Portal/Apps), e.g., /opt/myapp/data and 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.

Personal tools