Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use PUID and GUID #122

Open
MariusROBERT opened this issue Jan 24, 2025 · 3 comments
Open

Can't use PUID and GUID #122

MariusROBERT opened this issue Jan 24, 2025 · 3 comments

Comments

@MariusROBERT
Copy link

MariusROBERT commented Jan 24, 2025

I tried to setup a minecraft server as non root by providing my PUID and GUID (1000:1000 obtained with id -p $user and id -g $user) but when I start the docker, I get these logs

First start of the docker container, start initialization process.
Starting with 1000:1000 (UID:GID)
fatal: The GID `1000' is already in use.

here's my whole docker-compose

version: "3"

services:
  minecraft:
    image: marctv/minecraft-papermc-server:1.21-111
    restart: always
    container_name: "mcserver"
    environment:
      - MEMORYSIZE=1G
      - PAPERMC_FLAGS=""
      - PUID=1000
      - PGID=1000
    volumes:
      - ./minecraft:/data
    ports:
      - "25565:25565"

I tried to remove the PUID and GUID lines in the docker-compose but it change the ownership of my files and I'd prefer to avoir running my container as root

I tried adding SKIP_PERM_CHECK=true in the env vars but I get a lot of java permission denied error at the server startup resulting in a final crash with red errors

[08:48:44 ERROR]: Failed to start the minecraft server
java.nio.file.AccessDeniedException: ./world/session.lock
[...]

I can provide the whole java logs error logs if needed

@b2un0
Copy link
Collaborator

b2un0 commented Jan 27, 2025

you can only do one of
docker run --user $uid:$gid

OR

add the PUID and GUID as environment variables

Both of them are not possible!

if you run the container with the docker --user argument, you must change the file permissions before with chown and add the SKIP_PERM_CHECK=true env.

https://chatgpt.com/share/679768fa-1970-800e-a353-33dfd84c1d22

@MariusROBERT
Copy link
Author

Yes, that's what I did, I put PUID and GUID in the docker-compose.yml (as mentioned in the original post) then built and started it with docker compose up --build -d

@MariusROBERT
Copy link
Author

MariusROBERT commented Feb 26, 2025

Just tried creating another user only used for this docker and it worked with PUID and PGID, not user: PUID:PGID

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants