itzg/docker-mc-backup

How to integrate with Lazymc

Open

#212 建立於 2025年3月2日

在 GitHub 查看
 (10 留言) (0 反應) (0 負責人)Shell (66 fork)github user discovery
enhancementhelp wanted

倉庫指標

Star
 (501 star)
PR 合併指標
 (PR 指標待抓取)

描述

First of all, I'd like to say that I'm having a blast with these projects. I'm a fairly new player in the Linux and Docker space so this question might come off obvious, but I'll ask anyway. I'm trying to set up a docker compose build that makes use of both lazymc-docker-proxy (which I found browsing the docs) and a backup container. Thing is, I can't get them to work together. I have basically this setup:

networks:
  minecraft-network:
    driver: bridge
    ipam:
      config:
        - subnet: 172.18.0.0/16

services:
  lazymc:
    image: ghcr.io/joesturge/lazymc-docker-proxy:latest
    networks:
      minecraft-network:
        ipv4_address: 172.18.0.2
    restart: unless-stopped
    volumes:
      - ./server:/server:ro
      - ./docker.sock:/var/run/docker.sock:ro
    ports:
      - "25565:25565"


  mc:
    image: itzg/minecraft-server
    container_name: mc_server
    networks:
      minecraft-network:
        ipv4_address: 172.18.0.3
    labels:
      - lazymc.enabled=true
      - lazymc.group=mc
      - lazymc.server.address=mc:25565
    stdin_open: true
    restart: "no"
    ports:
      - "25565:25565"
    environment:
      EULA: "TRUE"
      TYPE: "MODRINTH"
      MODRINTH_MODPACK: "BYfVnHa7"
      VERSION: "LATEST"
      MEMORY: "8G"
    volumes:
      - ./server:/data
      - /etc/timezone:/etc/timezone:ro
  
  restore-backup:
    image: itzg/mc-backup
    restart: "no"
    entrypoint: restore-rsync-backup
    volumes:
      - ./server:/data
      - ./backups:/backups:ro

  backups:
    image: itzg/mc-backup
    depends_on:
          mc:
            condition: service_healthy
    environment:
      BACKUP_INTERVAL: "24h"
      BACKUP_METHOD: "rsync"
      BACKUP_ON_STARTUP: "true"
      RCON_HOST: mc
      RCON_PASSWORD: "###"
      PRUNE_BACKUPS_COUNT: "7"
      TZ: "###"
      INITIAL_DELAY: 0
    volumes:
      - ./server:/data:ro
      - ./backups:/backups

Starting the services in this configuration throws the following error:

ERROR: for backups  Container "###" is unhealthy.
ERROR: Encountered errors while bringing up the project.

From my understanding, mc-backup needs the server container to be running and healthy at all times in order to successfully back up its data. It also checks for RCON command feedback before executing any custom scripts. If I'm getting this right, it means that lazymc shutting down the server container is basically interfering with the backup service and preventing it from running correctly. Is there any way to make them compatible? Am I just missing something? Thank you in advance.

貢獻者指南