Create minecraft/docker-compose.yml
:
services:
minecraft:
image: itzg/minecraft-server
container_name: minecraft
environment:
TYPE: FABRIC
SERVER_NAME: Dungeon
MOTD: Sir yes sir!
SEED: -2472515894149419506
DIFFICULTY: normal
VERSION: 1.21
MODRINTH_PROJECTS: |
lithium
skinrestorer
ONLINE_MODE: false
EULA: true
ports:
- 25565:25565
volumes:
- minecraft:/data
restart: unless-stopped
volumes:
minecraft:
name: minecraft
To install and run:
cd minecraft
docker compose up -d
To execute command on server:
docker exec -i minecraft rcon-cli <COMMAND>
Quotes must be escaped in commands, for example:
docker exec -i minecraft rcon-cli skin set web slim \"https://i.imgur.com/GReASE4.png\" Playername