Docker image doesn't work properly with mounted volume of any type (permission issue?)

aasikki

Dabbler
Joined
Jan 30, 2023
Messages
12
I'm trying to run this docker container with a volume so that the game servers settings are saved even when the container is restarted:

The problem is that while the container works just fine without the mounted volume, after I do mount one, this is the result:
asdasasd.png


This is how I mount the volume:
1675106673868.png


I created a user "pp2host" with group "pp2host" and added the ID's to the container:
1675106715610.png


And of course set that user as the owned of the mounted dataset:
1675106755961.png


I have read just about every remotely related forum/reddit post and even asked about this in truenas discord, but haven't been able to find a solution. Would be amazing If someone could point me to the right direction, or even eli5 (explain like I'm five) how to set up that specific container properly. Thanks a lot for any help!
 

aasikki

Dabbler
Joined
Jan 30, 2023
Messages
12
I'm trying to run this docker container with a volume so that the game servers settings are saved even when the container is restarted:

The problem is that while the container works just fine without the mounted volume, after I do mount one, this is the result:
View attachment 63101

This is how I mount the volume:
View attachment 63102

I created a user "pp2host" with group "pp2host" and added the ID's to the container:
View attachment 63103

And of course set that user as the owned of the mounted dataset:
View attachment 63104

I have read just about every remotely related forum/reddit post and even asked about this in truenas discord, but haven't been able to find a solution. Would be amazing If someone could point me to the right direction, or even eli5 (explain like I'm five) how to set up that specific container properly. Thanks a lot for any help!
 

MisterE2002

Patron
Joined
Sep 5, 2015
Messages
211
the original image (without) the mapping/mount has a config file (etc/pp2host/pp2host.conf). You stopped the image, made a mount to truenas (assuming permissions are correct) and probably did not transfer the original config file(s) to truenas. So "/etc/pp2host" now is empty (see post). Some applications can create their own configuration files but some will crash.

You can actually "shell into" a container (use the 3 dots) and use the terminal to view files/permissions.

So, the solution can be cumbersome, maybe easier ways. But this is how i would do it:

* Stop container, modify mapping
* Create a mapping to unrelated place. For example -> "/mnt/Floppy Disk/pp2host" to "/transfer"
* Start the image, shell into the container. Now you should see the files in "/etc/pp2host".
* Copy all the files to "/transfer". Something like "cp -r /etc/pp2host/* /transfer". (if the app actually is using a DB it can lock the files and can corrupt the copied data. But i assume the easy solution)
* Now you should see the correct files on your nas (/mnt/Floppy Disk/pp2host)
* Stop the container again
* Now make the actual "/mnt/Floppy Disk/pp2host" to "/etc/pp2host" mapping.
* Start the container.
 
Last edited:

aasikki

Dabbler
Joined
Jan 30, 2023
Messages
12
the original image (without) the mapping/mount has a config file (etc/pp2host/pp2host.conf). You stopped the image, made a mount to truenas (assuming permissions are correct) and probably did not transfer the original config file(s) to truenas. So "/etc/pp2host" now is empty (see post). Some applications can create their own configuration files but some will crash.

You can actually "shell into" a container (use the 3 dots) and use the terminal to view files/permissions.

So, the solution can be cumbersome, maybe easier ways. But this is how i would do it:

* Stop container, modify mapping
* Create a mapping to unrelated place. For example -> "/mnt/Floppy Disk/pp2host" to "/transfer"
* Start the image, shell into the container. Now you should see the files in "/etc/pp2host".
* Copy all the files to "/transfer". Something like "cp -r /etc/pp2host/* /transfer". (if the app actually is using a DB it can lock the files and can corrupt the copied data. But i assume the easy solution)
* Now you should see the correct files on your nas (/mnt/Floppy Disk/pp2host)
* Stop the container again
* Now make the actual "/mnt/Floppy Disk/pp2host" to "/etc/pp2host" mapping.
* Start the container.
I configured the mount right away when creating the app. Now trying it with the truecharts "custom-app". Mounted a folder from nfs share that works fine for other apps. Shouldn't the app just create the files there? I believe the documentation in the dockerhub would mention copying the files if it wouldn't. I've also ran this same app on ubuntu (not in docker) many times and it has always created the files by itself.
 

Kendog

Cadet
Joined
Jul 17, 2012
Messages
4
I just found this: https://www.truenas.com/docs/scale/scaletutorials/apps/usingapps/#deploying-official-applications

Since TrueNAS considers shared host paths non-secure, apps that use shared host paths (such as those services like SMB are using) fail to deploy. Best practice is to create datasets for applications that do not share the same host path as an SMB or NFS share. If you want apps to deploy in a shared host path, either disable Enable Host Path Safety Checks in Applications > Settings > Advanced Settings or alter the path for shares and applications. For example, if you want to group the share and application data under a common dataset such as media, where both use a path such as /tank/media/, and you want to enable host path validation, this can result in the application not moving past the deployment stage. You can still group shares and applications under media but alter the path for shares and apps, such as /tank/media-shares or /tank/media/shares/sharename and /tank/media-apps or /tank/media/apps/appname. This differs enough to use host path validation and avoid issues that prevent application deployment.
 
Top