Problem with file permission

Hi!

i’m new to docker and i’m having a couple of problems, i want to create a minecraft server and i’m using the following docker compose;

services:
  mc:
    image: itzg/minecraft-server
    tty: true
    stdin_open: true
    ports:
      - 25565:25565
      - 25575:25575
    environment:
      TYPE: PAPER
      EULA: "TRUE"
      VERSION: "1.21"
      MOTD: Server docker
      ONLINE_MODE: "TRUE"
      MEMORY: 2G
      INIT_MEMORY: 1G
      MAX_MEMORY: 2G
      #RCON:
      ENABLE_RCON: "TRUE"
      RCON_PASSWORD: *****
      RCON_PORT: "25575"
      MAX_PLAYERS: "4"
    volumes:
      # attach the relative directory 'data' to the container's /data path
      - /mnt/Applicazioni/minecraftdata:/data
networks: {}

If i just let it run, the server will generate the save files and works perfectly.

i woild like to copy save files to it, and other files (plugins, configs etc…)

I did try to use “FileBrowser” and the copy is succesfull

but when i then try to start the server i get this error:
minecraft-mc-1 | java.nio.file.AccessDeniedException: ./world

i’m pretty sure this is happening becouse the copied files are owned by somebody else?

So far i’ve experimented with changing the uid and gid of the minecraft container to the same ad the filebrowser container but no luck… i did also give 775 to the folder on the host system but i face the same since i have no experience i’m at a loss.

Additional notes:
i’m using Dockge as a manager
the host is: TrueNAS-SCALE-ElectricEel-BETA (beta software, i know but still i don’t think this issue is caused by the beta)
other much more complex container staks like seafile run just fine

thank you in advance!

Update your yaml file and add a user node like :

services:
  user: 1000:1000

The first 1000 is your user id and the second one is your group id.

You can retrieve your own values using id -u and id -g in your console.

1 Like

Thanks! adding “user: …” right after services would cause an error, i added it right ad the end before the networks with the resulting configuration:

services:
  mc:
    image: itzg/minecraft-server
    tty: true
    stdin_open: true
    ports:
      - 25565:25565
      - 25575:25575
    environment:
      TYPE: PAPER
      EULA: "TRUE"
      VERSION: "1.21"
      MOTD: Server docker
      ONLINE_MODE: "TRUE"
      MEMORY: 2G
      INIT_MEMORY: 1G
      MAX_MEMORY: 2G
      #RCON:
      ENABLE_RCON: "TRUE"
      RCON_PASSWORD: pizzapazza
      RCON_PORT: "25575"
      MAX_PLAYERS: "4"
    volumes:
      # attach the relative directory 'data' to the container's /data path
      - /mnt/Applicazioni/minecraftdata:/data
    user: 568:568
networks: {}

For other truenas users, i got the “568:568” (UID, GID) from the “Application Metadata” in the “Apps” sections these are the same as file browser.

And now it works!
Thank you!