Skip to content

Instantly share code, notes, and snippets.

@pdrok
Created June 11, 2025 10:56
Show Gist options
  • Select an option

  • Save pdrok/8a5d073298bd76fe8abc51a6a2df2e36 to your computer and use it in GitHub Desktop.

Select an option

Save pdrok/8a5d073298bd76fe8abc51a6a2df2e36 to your computer and use it in GitHub Desktop.

Using Docker or Podman to Launch a Minecraft Server

You can use Docker or Podman to launch the container.

Install Docker

https://docs.docker.com/engine/install/ubuntu/

To make the process easier, you can install Docker Desktop.

Install Podman

Debian/Ubuntu

sudo apt-get update
sudo apt-get -y install podman

Another option is to install Podman Desktop:
https://podman-desktop.io/downloads

Install podman-compose inside a Python virtual environment (venv)

pip install podman-compose

Install podman-compose for all users

pip install podman-compose --break-system-packages

Create and Configure the Environment

Create a folder for the files:

mkdir ~/MCserver

Inside the folder, create a compose.yaml file with the following content:

services:
  mc:
    image: itzg/minecraft-server
    tty: true
    stdin_open: true
    ports:
      - "25565:25565"
      - "19132:19132/udp"
    environment:
      EULA: "TRUE"
      MEMORY: "4096M"
      VERSION: "1.21.5"
      TYPE: "PAPER"
      PAPER_CHANNEL: "experimental"
      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
    volumes:
      - ./data:/data

Bedrock Compatibility

      VERSION: "1.21.5"
      TYPE: "PAPER"
      PAPER_CHANNEL: "experimental"
      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

Configurable Ports

    ports:
      - "25565:25565"
      - "19132:19132/udp"
  • Port 25565 is for Java, and 19132 is for Bedrock.
  • The plugin for Bedrock is in experimental state:
PAPER_CHANNEL: "experimental"

Download the Server Image

podman pull docker.io/itzg/minecraft-server:latest

Restore a Previous World (Optional)

sudo cp -rfv MyWorld/* MCserver/data/world/
cd MCserver/data/world/
sudo rm -r session.lock
sudo chown -R 100999:100999 .

Start the Container

cd ~/MCserver
podman-compose up
  • To stop: Ctrl + C

Use Previously Downloaded Plugins

Edit compose.yaml:

      PLUGINS: |
        /data/plugins/Geyser-Spigot.jar
        /data/plugins/floodgate-spigot.jar

Full file:

services:
  mc:
    image: itzg/minecraft-server
    tty: true
    stdin_open: true
    ports:
      - "25565:25565"
      - "19132:19132/udp"
    environment:
      EULA: "TRUE"
      MEMORY: "4096M"
      VERSION: "1.21.5"
      TYPE: "PAPER"
      PAPER_CHANNEL: "experimental"
      PLUGINS: |
        /data/plugins/Geyser-Spigot.jar
        /data/plugins/floodgate-spigot.jar
    volumes:
      - ./data:/data

Start in background:

podman-compose up -d

Check Status and Logs

podman ps
podman logs -f mcserver_mc_1

Start as a Service

mkdir -p ~/.config/systemd/user/
cd ~/.config/systemd/user/
podman generate systemd --new --files --name mcserver_mc_1

Edit container-mcserver_mc_1.service:

-e PLUGINS=/data/plugins/Geyser-Spigot.jar,/data/plugins/floodgate-spigot.jar \

Start the service:

systemctl --user daemon-reload
systemctl --user enable container-mcserver_mc_1
systemctl --user start container-mcserver_mc_1
systemctl --user status container-mcserver_mc_1

Further Reading

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