A dockerized application designed to run a Minecraft server automatically on startup.
The advantages of Dockerizing a Minecraft server:
- Run the server on any operating system that supports Docker
- Easily run multiple servers with altering Java versions
- Automatically launch your servers on system startup
- More consistent software conditions, making troubleshooting easier
git clone https://github.com/ignwombat/minecraft-docker
Minecraft servers require Java to be installed on the system to run. You need to download a version of java into the docker folder
- To run Minecraft on version 1.19.x, Java 17 is required
- Other versions, such as modded 1.12.2 use Java 8 instead
To avoid any issues, make sure to download the tar.gz Linux x64 archive
Do not extract the archive!
By default, the Docker Compose File searches for java.tar.gz. Rename the archive to this.
Save the jarfile as server.jar into the docker folder
All files inside the data folder get copied to the root directory of the server. Any additional configuration of the server, such as plugins, mods or scripts should be added here.
If you want to use a custom world, add the save in the root directory, and make sure the name corresponds with level-name in server.properties. The default name is "world".
This is also where you can edit the server.properties file.
Note: if you place a "world" or "config" folder in the data directory, these will be ignored, as they are accessed in root.
Make sure the terminals current working directory (CWD) is in the root folder.
If it's the first time launching the server, or any changes have been made to the files, run the following command:
docker compose up -d
Otherwise, run the following command:
docker compose start -d
To send a command to the server:
docker compose exec -d minecraft say hello
To gracefully shut down the server:
docker compose exec -d minecraft stop
docker compose stop
Because minecraft.env doesn't load before docker compose, you must either change the Docker Compose File directly, or add a file named .env with the following contents:
MINECRAFT_SERVER_PORT=25566
If you're using plugins that require configuration files, the config folder will be available in the root folder after the first launch, similar to the world folder.