Using this Image in a rootless Docker setup, results in wrong file ownership
- Dominant language
- Shell
- Stars
- 346
- Forks
- 78
- Avg merge
- 8h 44m
- Merged PRs (30d)
- 8
Description
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 https://github.com/itzg/docker-mc-proxy/blob/de6e68ed1e2167c4c2d02d012ff8a323baaea697/scripts/run-bungeecord.sh#L464-L466
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:
```yml
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:
```bash
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:
```bash
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
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Read scripts/run-bungeecord.sh around the referenced $UID == 0 check, then reproduce the issue with the provided rootless Docker Compose setup. Compare ownership before and after configuration processing; done means files retain the expected host ownership without the UID workaround while existing setups continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, shell
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100