Skip to content

Using this Image in a rootless Docker setup, results in wrong file ownership #236

Open
@parzival-space

Description

@parzival-space

When running this this image in a rootless Docker setup, the file ownership get changed as soon as the configuration processing is completed.
You can actually observe this behavior by killing the container before the config processing gets completed. All files will have the correct ownership until the processing completes.

I guess this is caused by the $UID == 0 check in

if [ $UID == 0 ]; then
chown -R bungeecord:bungeecord $BUNGEE_HOME
fi

When running a rootless container, the root user in the container is the actual user the container runs under.

I could workaround this issue by simply setting the UID variable to literally anything that is not 0, so I am not sure if this check is somewhat redundant 🤔

For reference here is my docker-compose.yml configuration:

services:
  proxy:
    image: itzg/mc-proxy
    restart: always
    user: 0:0
    environment:
      UID: 12321 # workaround for rootless docker
    ports:
      - 25565:25565/tcp
      - 25565:25565/udp
    env_file:
      - ./global.env
      - ./proxy/proxy.env
    volumes:
      - ./proxy/data:/server
      - ./proxy/patches:/patches
      - ./proxy/plugins:/plugins
      - ./proxy/config:/config

Permissions of the ./proxy/data directory with the workaround:

total 17148
drwxr-xr-x  2 parzival parzival     4096 Apr 10 14:41 lang
drwxr-xr-x  2 parzival parzival     4096 Apr 10 14:41 logs
drwxr-xr-x 10 parzival parzival     4096 Apr 10 14:41 plugins
-rw-r--r--  1 parzival parzival       22 Apr  9 14:50 proxy-secret.txt
-rw-r--r--  1 parzival parzival     3820 Apr  4 01:43 server-icon.png
-rw-r--r--  1 parzival parzival 17521826 Apr 10 14:41 velocity-3.4.0-SNAPSHOT-491.jar
-rw-r--r--  1 parzival parzival     8311 Apr  9 14:49 velocity.toml
drwxr-xr-x  2 parzival parzival     4096 Apr 10 14:41 whitelists

And here are the permissions of the ./proxy/data directory without setting the UID workaround:

total 17148
drwxrwxr-x  2 100999 100999     4096 Apr 10 14:43 lang
drwxrwxr-x  2 100999 100999     4096 Apr 10 14:43 logs
drwxr-xr-x 10 100999 100999     4096 Apr 10 14:43 plugins
-rw-r--r--  1 100999 100999       22 Apr  9 14:50 proxy-secret.txt
-rw-r--r--  1 100999 100999     3820 Apr  4 01:43 server-icon.png
-rw-r--r--  1 100999 100999 17521826 Apr 10 14:43 velocity-3.4.0-SNAPSHOT-491.jar
-rw-r--r--  1 100999 100999     8311 Apr  9 14:49 velocity.toml
drwxrwxr-x  2 100999 100999     4096 Apr 10 14:43 whitelists

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions