Jump to content

Rechte im Docker


Recommended Posts

Posted

Hi,

ich habe das Docker am laufen und konnte das Backup auch zurückspielen.

Wenn ich ein neues Backup erstellen will erhalte ich jedoch diese Fehlermeldung.

Wo muss ich die Rechte vergeben und welche sind das.

image.png.628a5b21b895573ebbc11530683a7c6d.png

 

Der Container ist so erstellt worden.

image.png.28b1fb5ff32c96272fd6f1c9156fcc63.png

Danke vorab.

Posted

Hi, does this help?

Docker volumes, by default, are mounted with read/write permissions. This means that data written to the volume from within the container will be persisted on the host machine, and changes made on the host in the mounted directory will be reflected inside the container. 
 
However, issues with write access can arise due to file ownership and permissions, particularly when a non-root user within the container attempts to write to a volume that is owned by root on the host or has restrictive permissions. 
 

To ensure write access to a Docker volume for a non-root user within a container, consider the following approaches: 
 
Align User IDs (UIDs) and Group IDs (GIDs):
Ensure the user running the process inside the container has a UID and GID that matches the ownership of the mounted volume on the host. This can often be achieved by specifying the user in the docker run command using the -u flag (e.g., docker run -u
 
image.gif
(id−u)∶open paren i d minus u close paren colon
(𝑖𝑑−𝑢)∶
(id -g) ...).
  • Adjust Permissions within the Container (Entrypoint Script):

    Create an entrypoint script that executes chown and chmod commands on the mounted volume path within the container to grant the necessary permissions to the intended user before the application starts.

  • Pre-configure Volume Permissions on the Host:

    Manually set the appropriate file permissions and ownership on the host directory that will be mounted as a volume before starting the Docker container.

  • Initialize Volume with a Temporary Container:

    For named volumes, you can use a temporary container to initialize the volume and set the correct permissions before your main application container uses it.

  • Use Dockerfile to Set Permissions:

    If you are building a custom image, you can include commands in your Dockerfile to create directories with the correct ownership and permissions for the non-root user that will run the application.

  • Run as Root (Less Recommended):

    While possible, running the container process as the root user is generally discouraged for security reasons. If absolutely necessary, this will bypass permission issues but should be used with caution.

Posted

Hi,

yes no it works. I Used the same UID like the folders on NAS.

THX

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...