mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-12-13 22:02:28 +00:00
4.3 KiB
4.3 KiB
Examples
Various examples are maintained in the repository. The sections below highlight a few particular ones.
Bedrock compatible server
Using the GeyserMC plugin with a Paper server (or similar) "enables clients from Minecraft Bedrock Edition to join your Minecraft Java server". The example also includes Floodgate which "allows Xbox Live authenticated Bedrock users to join without a Java Edition account".
services:
mc:
image: itzg/minecraft-server
environment:
EULA: "true"
TYPE: "PAPER"
PLUGINS: |
https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/spigot
https://download.geysermc.org/v2/projects/floodgate/versions/latest/builds/latest/downloads/spigot
ports:
- "25565:25565"
- "19132:19132/udp"
volumes:
- ./data:/data
Lazymc - Put your Minecraft server to rest when idle
With lazymc-docker-proxy you are able to use lazymc with the minecraft container.
services:
lazymc:
container_name: lazymc
image: ghcr.io/joesturge/lazymc-docker-proxy:latest
environment:
# Point to the service name of the Minecraft server
SERVER_ADDRESS: mc:25565
# Required to find the container to manage it
LAZYMC_GROUP: mc
restart: unless-stopped
volumes:
# you should mount the minecraft server dir under /server, using read only.
- data:/server:ro
# you need to supply the docker socket, so that the container can run docker command
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
# lazymc-docker-proxy acts as a proxy, so there is
# no need to expose the server port on the Minecraft container
- "25565:25565"
# Standard Docker Minecraft server, also works with other server types
mc:
image: itzg/minecraft-server:java21
container_name: minecraft-server
# We need to add a label here so that lazymc-docker-proxy knows which
# container to manage
labels:
- lazymc.group=mc
tty: true
stdin_open: true
# This container should be managed solely by the lazymc container
# so set restart to no, or else the container will start again...
restart: no
environment:
EULA: "TRUE"
volumes:
- data:/data
volumes:
data:
Lazytainer - Stop Minecraft container based on traffic
Monitors network traffic to the Minecraft containers. If there is traffic, the container runs, otherwise the container is stopped/paused.
By using Lazytainer with the docker-minecraft-server a somehow similar behaviour to Lazymc can be archived.
services:
lazytainer:
image: ghcr.io/vmorganp/lazytainer:master
environment:
VERBOSE: false
ports:
- 25565:25565
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
- lazytainer.group.minecraft.sleepMethod=stop
- lazytainer.group.minecraft.ports=25565
- lazytainer.group.minecraft.minPacketThreshold=2 # Start after two incomming packets
- lazytainer.group.minecraft.inactiveTimeout=600 # 10 minutes, to allow the server to bootstrap. You can probably make this lower later if you want.
restart: unless-stopped
network_mode: bridge
mc:
image: itzg/minecraft-server
environment:
EULA: TRUE
TYPE: PAPER
MEMORY: 4G
volumes:
- ./data:/data
labels:
- lazytainer.group=minecraft
depends_on:
- lazytainer
network_mode: service:lazytainer
tty: true
stdin_open: true
restart: unless-stopped