Docker : Applications data are not saved

mapomme

Dabbler
Joined
May 7, 2021
Messages
10
Hello,

First, excuse me if my english is not good, I am french.

I mount a nas with TrueNAS Scale and I installed applications via Docker (Jellyfin, Syncthing, apache, ...) but when I restart the applications or the nas, the application data is erased and the settings must be redone for every application.

Can you tell me what settings should be made so that applications data is not erased?

Thanks for your help :)
 

pondwater

Cadet
Joined
Oct 30, 2021
Messages
3
when you are at the storage section of you docker setup you have to add the volumes into the configure volumes section then persitence well be there
 

mapomme

Dabbler
Joined
May 7, 2021
Messages
10
Hello,

I have added the volumes and persistence is there : thank you

It works for jellyfin, airsonic and syncthing but not for ubuntu/apache2.

For ubuntu/apache2, when I add the volume /var/www/html : it works
But when I add /etc/apache2 : the container does not start
this is where the apache configuration files are stored
 
Last edited:

aasikki

Dabbler
Joined
Jan 30, 2023
Messages
12
Hello,

I have added the volumes and persistence is there : thank you

It works for jellyfin, airsonic and syncthing but not for ubuntu/apache2.

For ubuntu/apache2, when I add the volume /var/www/html : it works
But when I add /etc/apache2 : the container does not start
this is where the apache configuration files are stored
Did you find any solution to this? I have a similar issue where a container I'm trying to run works fine without volume, but as soon as I mount a volume (the mount loation needed is under /etc), the app stops working, probably because the files needed in the mounted location don't get generated for some reason, even though without a volume it works fine.
 

MisterE2002

Patron
Joined
Sep 5, 2015
Messages
211
A docker image is immutable. Every time you start a container the app is reset. So, you have to make sure the dynamic part is on the Host (truenas). One way is PVC and the other way is : host path mounts.

If you use the official/truechart images it is automatically managed for you. But if you use a "normal" dockerhub image you need to know/understand the volumes.

For example. This image is storing its data in "/config", but this image is using "/datadir". So, you have to make sure this is preserved after the restart.

Also note, IF you make a mapping it will "hide/overrule" the files of the original image. For example. I spin up a image. I have ssl based files in "/etc/ssl". Now i terminate the container and i make a truenas mapping "/mnt/tank/random_folder" -> "/etc/ssl". If i start the container all the "ssl" files are hidden and i only see the content of "random_folder" in "/etc/ssl".

So, it is easy to break stuff.
"/etc" contains important operating stuff.

It is also questionable to modify those actually. If you have to need the app in such integral/structural way you better can create your own image (based on the original one) and overrule the file(s) in the new "layer".

Practical example. sabnzbd.
Let, for example, say that you want to change a openssl setting which is not supported by the app. As we see in the repo it installs openssl . This will also create a "/etc/" entry like "/etc/ssl/ssl.conf". You can create your own image based on this one and ONLY modify this "/etc/ssl/ssl.conf" file. This will create a new "layer" and overrule the file created by the original author.


TLDR: if you want to modify app settings use the image as intended. If you need to modify "OS" stuff you need to create you own image.
 
Top