Skip to content

Instantly share code, notes, and snippets.

@SCP002
Last active July 27, 2024 12:03
Show Gist options
  • Save SCP002/25fadc76531bb879ddea6d2f60815ece to your computer and use it in GitHub Desktop.
Save SCP002/25fadc76531bb879ddea6d2f60815ece to your computer and use it in GitHub Desktop.
Minecraft: Run fabric server with mods in docker container.

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

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