Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Docker images for Spigot, Paper, and Vanilla Minecraft

License

Notifications You must be signed in to change notification settings

shepherdjerred-minecraft/minecraft-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minecraft Docker Images

CI/CD

Open in GitHub Codespaces

A Dockerfile to build and run both Spigot, Paper and Vanilla Minecraft.

You can quickly try it out with this command:

docker run \
  --rm \
  -p 25565 \
  -it \
  ghcr.io/shepherdjerred-minecraft/paper:latest

Features

  • Uses the latest Amazon Coretto for the latest Java LTS (currently Java 17)
  • Supports the latest versions of Spigot, Paper, and Vanilla Minecraft
  • No need to worry about server jarfiles -- just mount a server data directory and go
  • Always uses the latest build tools for Spigot and Paper
  • Automatically builds every day

Images

Pre-built images are located here:

Tags

The following tags are available for these images:

  • latest
  • 1.20.1

Building

Install Earthly and then run earthly -P +ci in this directory.

Adding a New Minecraft Version

New versions is easy.

  1. Add the version to the Earthfile
  2. Add the URL to the vanilla .jar in vanilla.sh

Updating Java

  1. Update the base image version

Usage

The Docker image has a filesystem as follows:

/home/minecraft/
├── server.jar
└── server/
    └── plugins/

The working directory of the image is at /home/minecraft/server. Your server files should be mounted at /home/minecraft/server. To use the .jar provided by the image, you'll have to pass the argument -jar ../server.jar to Docker so that Java is invoked correctly. This is a bit confusing, but it allows end-users to easily bind-mount their server files.

Note that the server directory does not have a server jarfile.

Docker Compose

services:
  minecraft:
    # Swap paper for `spigot` or `minecraft`
    # Swap `1.20.1` with `latest` or another version of Minecraft
    image: ghcr.io/shepherdjerred-minecraft/paper:1.20.1
    tty: true
    stdin_open: true
    volumes:
      # Change `/path/to/server/files` to the absolute path that your sever fiels are located at
      # Do NOT change `/home/minecraft/server`
      - /path/to/server/files:/home/minecraft/server:z
    ports:
      # Change the first 25565 to another port if needed
      - 25565:25565/tcp
      - 25565:25565/udp
    # Change how much memory you're giving Java if needed
    # Do NOT change `../server.jar`
    command: -Xmx1G -Dcom.mojang.eula.agree=true -jar "../server.jar"
    restart: unless-stopped

docker run

docker run \
  --rm \
  --name minecraft \
  # Change the first 25565 to another port if needed
  -p 25565:25565/tcp \
  -p 25565:25565/udp \
  # Change `/path/to/server/files` to the absolute path that your sever fiels are located at
  # Do NOT change `/home/minecraft/server`
  --mount type=bind,source=/path/to/server/files,target=/home/minecraft/server \
  -it \
  # Swap paper for `spigot` or `minecraft`
  # Swap `1.20.1` with `latest` or another version of Minecraft
  ghcr.io/shepherdjerred-minecraft/paper:1.20.1 \
  # Change how much memory you're giving Java if needed
  -Xmx1G \
  -Dcom.mojang.eula.agree=true \
  # Do NOT change `../server.jar`
  -jar "../server.jar"