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

Receiving "Cannot open: Permission denied" error #197

Open
DrewCranmer opened this issue Jul 17, 2024 · 2 comments
Open

Receiving "Cannot open: Permission denied" error #197

DrewCranmer opened this issue Jul 17, 2024 · 2 comments

Comments

@DrewCranmer
Copy link

DrewCranmer commented Jul 17, 2024

I'm receiving a "Cannot open: Permission denied" error when trying to run a tar backup.

image

Here are the contents of my docker-compose file. Do I have something wrong?

services:
  mc:
    image: itzg/minecraft-server
    tty: true
    stdin_open: true
    ports:
      - "25565:25565"
    environment:
      EULA: "TRUE"
      TYPE: FABRIC
      VERSION: 1.20.1
      INIT_MEMORY: 1024M
      MAX_MEMORY: 5120M
      MOTD: A Drewbuntu Server
      DIFFICULTY: Normal
      SERVER_NAME: Tuxcraft Fabric
      PLAYER_IDLE_TIMEOUT: 0
      PLUGINS: |
        https://cdn.modrinth.com/data/L695BdOy/versions/EjNpDfo3/SetSpawn-3.1.jar
      ICON: https://icons.iconarchive.com/icons/papirus-team/papirus-apps/72/tux-icon.png
    depends_on:
      restore-backup:
        condition: service_completed_successfully
    volumes:
      - ./minecraft-data:/data
      - ./mods.txt:/extras/mods.txt:ro
  restore-backup:
    # Same image as mc, but any base image with bash and tar will work                                                      
    image: itzg/mc-backup
    user: "1000"
    restart: no
    entrypoint: restore-tar-backup
    volumes:
      # Must be same mount as mc service, needs to be writable
      - ./minecraft-data:/data
      # Must be same mount as backups service, but can be read-only
      - ./minecraft-backups:/backups:ro
  backups:
    image: itzg/mc-backup
    user: "1000"
    depends_on:
      mc:
        condition: service_healthy
    environment:
      BACKUP_INTERVAL: "4h"
      RCON_HOST: mc
      # since this service waits for mc to be healthy, no initial delay is needed
      INITIAL_DELAY: 0
      # As an example, to backup only the world data:
      # INCLUDES: world,world_nether,world_the_end
      PRUNE_BACKUPS_DAYS: 7
    volumes:
      - ./minecraft-data:/data:ro
      - ./minecraft-backups:/backups
@itzg
Copy link
Owner

itzg commented Jul 17, 2024

Double check the ownership and/or permissions on your host directory ./minecraft-data. The containers are accessing that as user ID 1000. If you're running root-less containers such as with podman, I believe you'll also need to lookup the UID mapping.

@DrewCranmer
Copy link
Author

I thought I had already changed permissions to grant other users read and write. When looking at ownership, however, I noticed that my minecraft-backups folder was owned by root:root.
image

I changed it to drew:drew like all of the others....
image

....and now the backup works!
image

Thank you so much for the speedy reply!

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

No branches or pull requests

2 participants