-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
minecraft-server-docker-compose.yml
140 lines (124 loc) · 5.94 KB
/
minecraft-server-docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Minecraft Server Using Docker Compose
# The complete installation guide is available on my website https://www.heyvaldemar.com/install-minecraft-server-using-docker-compose/
# For details on deploying the Minecraft Proxy, check out this link https://github.com/heyvaldemar/minecraft-server-proxy-docker-compose/
# Change variables in the `.env` to meet your requirements.
# Note that the `.env` file and `plugins` folder should be in the same directory as `minecraft-server-docker-compose.yml`.
# Create a network for your services before deploying the configuration using the command:
# `docker network create minecraft-server-network`
# Deploy Minecraft Server using Docker Compose:
# `docker compose -f minecraft-server-docker-compose.yml -p minecraft-server up -d`
# You can check the Minecraft Server status using the commands:
# ```
# MINECRAFT_SERVER_CONTAINER=$(docker ps -aqf "name=minecraft-server-minecraft-server") \
# && docker exec -it $MINECRAFT_SERVER_CONTAINER mc-monitor status
# ```
# # Minecraft Servers Logs
# You can check logs using the commands:
# ```
# MINECRAFT_SERVER_CONTAINER=$(docker ps -aqf "name=minecraft-server-minecraft-server") \
# && docker logs $MINECRAFT_SERVER_CONTAINER
# ```
# # Minecraft Server Management
# Apply new configuration after a change in the `minecraft-server-docker-compose.yml` or `.env` using the command:
# `docker compose -f minecraft-server-docker-compose.yml -p minecraft up -d`
# Connect to the Minecraft server command-line interface using the command:
# ```
# MINECRAFT_SERVER_CONTAINER=$(docker ps -aqf "name=minecraft-server-minecraft-server") \
# && docker exec -i $MINECRAFT_SERVER_CONTAINER rcon-cli
# ```
# Backups
# The `minecraft-server-data-backups` folder, holding all server backups,
# will be automatically created in the same directory as `minecraft-server-docker-compose.yml` upon the server's initial startup.
# Author
# I’m Vladimir Mikhalev, the Docker Captain, but my friends can call me Valdemar.
# https://www.docker.com/captains/vladimir-mikhalev/
# My website with detailed IT guides: https://www.heyvaldemar.com/
# Follow me on YouTube: https://www.youtube.com/channel/UCf85kQ0u1sYTTTyKVpxrlyQ?sub_confirmation=1
# Follow me on Twitter: https://twitter.com/heyValdemar
# Follow me on Instagram: https://www.instagram.com/heyvaldemar/
# Follow me on Threads: https://www.threads.net/@heyvaldemar
# Follow me on Mastodon: https://mastodon.social/@heyvaldemar
# Follow me on Bluesky: https://bsky.app/profile/heyvaldemar.bsky.social
# Follow me on Facebook: https://www.facebook.com/heyValdemarFB/
# Follow me on TikTok: https://www.tiktok.com/@heyvaldemar
# Follow me on LinkedIn: https://www.linkedin.com/in/heyvaldemar/
# Follow me on GitHub: https://github.com/heyvaldemar
# Communication
# Chat with IT pros on Discord: https://discord.gg/AJQGCCBcqf
# Reach me at [email protected]
# Give Thanks
# Support on GitHub: https://github.com/sponsors/heyValdemar
# Support on Patreon: https://www.patreon.com/heyValdemar
# Support on BuyMeaCoffee: https://www.buymeacoffee.com/heyValdemar
# Support on Ko-fi: https://ko-fi.com/heyValdemar
# Support on PayPal: https://www.paypal.com/paypalme/heyValdemarCOM
networks:
minecraft-server-network:
external: true
services:
minecraft-server:
image: ${MINECRAFT_SERVER_IMAGE_TAG}
volumes:
- ./minecraft-server-data:${DATA_PATH}
- ./plugins:/plugins:ro
environment:
EULA: ${MINECRAFT_SERVER_EULA}
TYPE: ${MINECRAFT_SERVER_TYPE}
VERSION: ${MINECRAFT_SERVER_VERSION}
MEMORY: ${MINECRAFT_SERVER_MEMORY}
SERVER_NAME: ${MINECRAFT_SERVER_SERVER_NAME}
MOTD: ${MINECRAFT_SERVER_MOTD}
LEVEL_TYPE: ${MINECRAFT_SERVER_LEVEL_TYPE}
LEVEL: ${MINECRAFT_SERVER_LEVEL}
MODE: ${MINECRAFT_SERVER_MODE}
FORCE_GAMEMODE: ${MINECRAFT_SERVER_FORCE_GAMEMODE}
DIFFICULTY: ${MINECRAFT_SERVER_DIFFICULTY}
HARDCORE: ${MINECRAFT_SERVER_HARDCORE}
ANNOUNCE_PLAYER_ACHIEVEMENTS: ${MINECRAFT_SERVER_ANNOUNCE_PLAYER_ACHIEVEMENTS}
MAX_PLAYERS: ${MINECRAFT_SERVER_MAX_PLAYERS}
PVP: ${MINECRAFT_SERVER_PVP}
ENABLE_RCON: ${MINECRAFT_SERVER_ENABLE_RCON}
RCON_PASSWORD: ${MINECRAFT_SERVER_RCON_PASSWORD}
RCON_PORT: ${MINECRAFT_SERVER_RCON_PORT}
SERVER_PORT: ${MINECRAFT_SERVER_SERVER_PORT}
ALLOW_FLIGHT: ${MINECRAFT_SERVER_ALLOW_FLIGHT}
MAX_WORLD_SIZE: ${MINECRAFT_SERVER_MAX_WORLD_SIZE}
MAX_BUILD_HEIGHT: ${MINECRAFT_SERVER_MAX_BUILD_HEIGHT}
SPAWN_ANIMALS: ${MINECRAFT_SERVER_SPAWN_ANIMALS}
SPAWN_MONSTERS: ${MINECRAFT_SERVER_SPAWN_MONSTERS}
SPAWN_NPCS: ${MINECRAFT_SERVER_SPAWN_NPCS}
SPAWN_PROTECTION: ${MINECRAFT_SERVER_SPAWN_PROTECTION}
VIEW_DISTANCE: ${MINECRAFT_SERVER_VIEW_DISTANCE}
ONLINE_MODE: ${MINECRAFT_SERVER_ONLINE_MODE}
SNOOPER_ENABLED: ${MINECRAFT_SERVER_SNOOPER_ENABLED}
ENABLE_COMMAND_BLOCK: ${MINECRAFT_SERVER_ENABLE_COMMAND_BLOCK}
WHITELIST: ${MINECRAFT_SERVER_WHITELIST}
OPS: ${MINECRAFT_SERVER_OPS}
TZ: ${MINECRAFT_SERVER_SERVER_TIMEZONE}
networks:
- minecraft-server-network
ports:
- "${MINECRAFT_SERVER_SERVER_PORT}:${MINECRAFT_SERVER_SERVER_PORT}"
restart: unless-stopped
backups:
image: ${MINECRAFT_SERVER_BACKUP_IMAGE_TAG}
environment:
RCON_HOST: minecraft-server
RCON_PORT: ${MINECRAFT_SERVER_RCON_PORT}
RCON_PASSWORD: ${MINECRAFT_SERVER_RCON_PASSWORD}
SERVER_PORT: ${MINECRAFT_SERVER_SERVER_PORT}
SRC_DIR: ${DATA_PATH}
BACKUP_METHOD: ${BACKUP_METHOD}
BACKUP_INTERVAL: ${MINECRAFT_SERVER_BACKUP_INTERVAL}
PRUNE_BACKUPS_DAYS: ${MINECRAFT_SERVER_PRUNE_BACKUPS_DAYS}
INITIAL_DELAY: ${MINECRAFT_SERVER_INITIAL_DELAY}
TZ: ${MINECRAFT_SERVER_SERVER_TIMEZONE}
volumes:
- ./minecraft-server-data:${DATA_PATH}:ro
- ./minecraft-server-data-backups:${MINECRAFT_SERVER_BACKUPS_PATH}
networks:
- minecraft-server-network
restart: unless-stopped
depends_on:
minecraft-server:
condition: service_healthy