A simple container for vanilla Minecraft servers. https://hub.docker.com/r/whiletruedo/minecraft
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
dschier ad355e8424 Feature: Release 1.17.1
This is just an update to the Minecraft 1.17.1 server.
2 years ago
.gitea/ISSUE_TEMPLATE Feature: issue templates 2 years ago
build Fix: upgrade issues with persistent volumes 2 years ago
docs Feature: metafile added 2 years ago
files Feature: Release 1.17.1 2 years ago
tests Fix: upgrade issues with persistent volumes 2 years ago
.editorconfig Feature: metafile added 2 years ago
.gitattributes Feature: metafile added 2 years ago
.gitignore Feature: metafile added 2 years ago
.gitmessage Feature: metafile added 2 years ago
.hadolint.yml Feature: tests and build 2 years ago
.minecraft.conf Feature: Release 1.17.1 2 years ago
CHANGELOG.md Fix: upgrade issues with persistent volumes 2 years ago
Containerfile Fix: upgrade issues with persistent volumes 2 years ago
KUDOS.txt Feature: envfile and version 2 years ago
LICENSE Initial commit 2 years ago
README.md Fix: upgrade issues with persistent volumes 2 years ago

README.md

Container: Minecraft

A simple container for vanilla Minecraft servers.

Disclaimer

while-true-do.io is NOT approved or endorsed by Mojang AB or Microsoft Corporation. We are also NOT associated or connected with Mojang AB or Microsoft Corporation.

Motivation

Playing some games is relaxing and Minecraft is something we wanted to play.

Description

This container is a wrapper to download and configure a Minecraft server properly. It can be used for your own game server at home or in a VPS.

Requirements

You need to have Docker or Podman installed.

Usage

Running the container is described in details in this section.

Minecraft Eula

Be aware, that You need to acknowledge the Minecraft EULA. You can read about it here https://www.minecraft.net/download/server/

To acknowledge the EULA, you need to provide --env EULA=true during the start.

Run container

You can run a simple instance and acknowledge the Eula.

# Podman (automatic port)
$ podman run --detach --tty --publish-all --env EULA=true whiletruedo/minecraft

# Podman (defined port)
$ podman run --detach --tty --publish 25565:25565 --env EULA=true whiletruedo/minecraft

# Docker (defined port)
$ docker run --detach --tty --publish 25565:25565 --env EULA=true whiletruedo/minecraft

You can also specify the version.

# Podman
$ podman run --detach --tty --publish-all --env EULA=true whiletruedo/minecraft:1.16.5

# Docker
$ docker run --detach --tty --publish-all --env EULA=true whiletruedo/minecraft:1.16.5

You can use a volume for persistent storage.

# Podman
$ podman run --detach --tty --publish-all --env EULA=true --volume minecraft:/opt/minecraft/ whiletruedo/minecraft

# Docker
$ docker run --detach --tty --publish-all --env EULA=true --volume minecraft:/opt/minecraft/ whiletruedo/minecraft

You can configure your server with environment variables. Please see below for details about usable variables and default values.

For simple configurations, you can provide the variables inline.

# Podman
$ podman run --detach --tty --publish-all --env EULA=true --env XMS=512M --env XMX=2048M --env PVP=false whiletruedo/minecraft

# Docker
$ docker run --detach --tty --publish-all --env EULA=true --env XMS=512M --env XMX=2048M --env PVP=false whiletruedo/minecraft

Since Mincecraft can be configured with several properties and options you can provide an environment file.

# Podman
$ podman run --detach --tty --publish-all --env-file=/path/to/file whiletruedo/minecraft

# Docker
$ docker run --detach --tty --publish-all --env-file=/path/to/file whiletruedo/minecraft

Variables

Minecraft can be tuned and configured to your liking via server properties. You can adjust various settings and behavior. For a complete list of supported options, please have a look at the envfile.sample. The Minecraft Wiki provides additional explanations for the properties.

Administration

Sometimes, you need to adjust settings on the fly. Minecraft offers a server console to interact with a running server. This can be useful to promote players to ops or ban players and test some settings.

After starting a container with one of the above commands, you can attach to the container and run server console commands.

# Podman
$ podman attach CONTAINERID
help
[19:57:07] [Server thread/INFO]: /advancement (grant|revoke)
[19:57:07] [Server thread/INFO]: /attribute <target> <attribute> (base|get|modifier)
[19:57:07] [Server thread/INFO]: /ban <targets> [<reason>]
[19:57:07] [Server thread/INFO]: /ban-ip <target> [<reason>]
[19:57:07] [Server thread/INFO]: /banlist [ips|players]
...
[19:57:07] [Server thread/INFO]: /worldborder (add|center|damage|get|set|warning)
[19:57:07] [Server thread/INFO]: /xp -> experience

/op mumbojumbo
[19:59:25] [Server thread/INFO]: Made MumboJumbo a server operator

After doing your administration, you can detach from the container with Ctrl+p Ctrl+q.

Please check here to get detailed documentation about the possible commands.

Known Issues

None.

Changelog

The repository contains a curated, chronological changelog, maintained by the owner for each release/tag.

Contribute

Thank you so much for considering to contribute! We are happy, when someone is joining the hard work. Please feel free to contribute, after having a look at the Conventions.

See who has contributed already in the KUDOS.txt.

Develop

The repository has some prepared build scripts and a configuration file. Normally, you want to do something like:

  1. Check/Review/Edit .minecraft.conf
  2. Do everything else, you need to tweak
  3. Ensure, that new files are covered in tests/test.sh
  4. Run the tests bash tests/test.sh
  5. Build a new container bash build/build.sh

Test

Some minimal testing is provided in the tests directory. You can run the tests with the below command.

# Run tests
$ bash tests/test.sh

License

Except where otherwise noted, all work is licensed under a GNU General Public License v3.0 or later.

Contact

Please feel free to get in touch with the developers and contributors.