Skip to content

ignwombat/minecraft-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minecraft Docker

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

Requirements

Setup

1. Clone the repository

git clone https://github.com/ignwombat/minecraft-docker

2. Download the desired Java version

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!

3. Rename the Java archive

By default, the Docker Compose File searches for java.tar.gz. Rename the archive to this.

4. Download a server jarfile

Save the jarfile as server.jar into the docker folder

5. Add extra content

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.

6. Start the server with docker compose

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

Changing the server port

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

Plugin configs

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.

About

A dockerized application designed to run a Minecraft server automatically on startup

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors