Simple docker for your own server jar
 
 
 
Go to file
dependabot[bot] bc997479f9
Merge pull request #20 from PHLAK/dependabot/docker/alpine-3.15.4
2022-05-02 17:29:47 +00:00
.github Workflow refactoring 2021-09-01 15:24:12 -07:00
files Trimmed some unnecessary lines in ops script 2019-12-21 10:25:44 -07:00
.dockerignore Updated project image in README 2019-12-21 10:26:25 -07:00
.editorconfig Added yaml file config to editorconfig 2021-09-01 15:05:46 -07:00
Dockerfile Bump alpine from 3.15.3 to 3.15.4 2022-05-01 18:01:27 +00:00
LICENSE Updated copyright year 2021-05-19 08:29:29 -07:00
Makefile Repaced build script with a Makefile 2019-12-10 15:55:48 -07:00
README.md README fixes 2021-05-19 08:29:19 -07:00
docker-minecraft.png Updated project image in README 2019-12-21 10:26:25 -07:00

README.md

docker-minecraft

Docker Minecraft

Join the Community Become a Sponsor One-time Donation
Docker Image Version Docker Pulls License Docker Cloud Build Status

Docker image for Minecraft server.


Running the Container

First create a named data volume to hold the persistent world and config data:

docker volume create --name minecraft-data

Then run the Minecraft server:

docker run -it -d -p 25565:25565 -v minecraft-data:/etc/minecraft --name minecraft-server phlak/minecraft

Optional 'docker run' Arguments

-e _JAVA_OPTIONS='-Xms256M -Xmx2048M'
Set JVM arguments for minimum/maximum memory consumption (default: '-Xms256M -Xmx2048M')
-e TZ=America/Phoenix
Set the timezone for your server. You can find your timezone in this list of timezones. Use the (case sensitive) value from the TZ column. If left unset, timezone will be UTC.
--restart unless-stopped
Always restart the container regardless of the exit status, but do not start it on daemon startup if the container has been put to a stopped state before. See the Docker restart policies for additional details.

NOTE: See the Minecraft Wiki for more info on memory requirements.

Editing the Server Config

Once you have a running container, you can edit the Minecraft server config with:

docker exec -it minecraft-server vi /etc/minecraft/server.properties

After saving changes, restart your container with docker restart minecraft-server

Adding OPs

Once you have a running server container you can add OPs by running:

docker exec minecraft-server ops [PLAYER_NAMES]

NOTE: Replace [PLAYER_NAMES] with the name of one or more players you wish to give OP privileges separated by a space. If a players name contains spaces wrap it in quotation marks.

Here's an example granting OP to three players with name's Marty, Jennifer and Doc Brown:

docker exec minecraft-server ops Marty Jennifer "Doc Brown"

Running Server Commands

You can run commands on the server (e.g. kick, ban, say, etc.) by attaching to the running container and running the commands. Attach to the server by running:

docker attach minecraft-server

Once attached you can run your commands like normal.

say Hello world!
[10:11:56] [Server thread/INFO]: [Server] Hello world!
list
[10:12:08] [Server thread/INFO]: There are 3 of a max 10 players online: Marty, Jennifer, Doc Brown
seed
[10:12:19] [Server thread/INFO]: Seed: [-5234790158571010769]

NOTE: In order to detach from the container and leave it running use the Ctrl + P then Ctrl + Q key sequence.

Upgrading the Server

First pull down the latest image:

docker pull phlak/minecraft

Remove your running server container:

docker rm -f minecraft-server

And run a new one with the same command/arguments as before.

Troubleshooting

For general help and support join our GitHub Discussions or reach out on Twitter.

Please report bugs to the GitHub Issue Tracker.

This project is licensed under the MIT License.