Sign inSign up

projectinitiative/apmc

By projectinitiative

•Updated over 6 years ago

A customized Alpine Linux image to manage a Vanilla Minecraft server running on Spigot/PaperMC

Image
1

582

projectinitiative/apmc repository overview

⁠apmc

A customized Alpine Linux Docker image to manage a Vanilla Minecraft server running on Spigot or PaperMC.

⁠GitHub

For more information, and to view the Dockerfile and all scripts included in the image, check out the GitHub⁠ repo.

⁠Docker Hub

Check out the Docker⁠ hub page.

⁠Usage

To run this server, and manage the server files and properties, please specify a directory on the host to house the Minecraft server files. The following docker command will create a container that will automatically run/build the server when it is started.

NOTE: If the EULA flag is not added, then on the first run, the server will not fully initialize until the user agrees to the end user licence agreement. After running the commands below, the user needs to edit the eula.txt file found in the root server directory on the host machine. The value eula=false needs to be changed to eula=true. There is no need to restart the server, just save changes and the server will auto-restart.

⁠Commands for Bash:
#!/bin/bash

dir="FULL-PATH-TO-STORE-SERVER-ON-HOST" 
mkdir -p $dir/Minecraft

sudo docker create --name=mc --tty -i \
	--restart=always \
	-v $dir/Minecraft:/home/Minecraft \
	-p 25565:25565 \
	-e EULA=true \
	projectinitiative/apmc

sudo docker start mc
⁠Commands for PowerShell:
$dir="FULL-PATH-TO-STORE-SERVER-ON-HOST" 
mkdir -p $dir\Minecraft

docker create --name=mc --tty -i `
	--restart=always `
	-v $dir/Minecraft:/home/Minecraft `
	-p 25565:25565 `
	-e EULA=true `
	projectinitiative/apmc

docker start mc

⁠Environmental Variables

VariableDescriptionValue Type Example
TZTimezoneAmerica/Chicago
minramMinimum RAM to allocate to the server1G/512M
maxramMaximum RAM to allocate to the server1G/512M
server_typeSpecify which type of server to be downloaded/compiledvanilla/spigot/paper
EULAAutomatically accepts the end user license agreement for the servertrue
start_scriptPath to custom start script (not named start.sh) Usually used for modded server packs with custom start scriptsPATH-TO-START-SCRIPT
backup_cronA crontab pattern for the frequency of which backups are made0 */12 * * *

Aside: Useful crontab generator⁠

NOTE: Environmental variables do not need to be specified to run the server. Default values will be used.

⁠Example Usage
sudo docker create --name=mc ...
...
...
-p 25565:25565 \
-e TZ=America/Chicago \
-e minram=512M \
-e maxram=4G \
-e server_type=paper \
-e EULA=true \
...
...

⁠Server Management

⁠Interacting with the Minecraft console

To interact with the command console without being in-game, run the following while the container is running

docker exec -it mc screen -r mc 

To exit the console safely use CTRL + A then CTRL + D

⁠Built-in Server Commands

CMDs that are built in:

  • start-server
  • stop-server
  • restart-server
  • upgrade-server

To use the commands listed above, run the following while the container is running

docker exec -it mc CMD

NOTE: Pre-built Spigot server jar files can be downloaded from the Spigot⁠ website. Move the jar file into the root server directory on the host and rename it spigot-server.jar. The PaperMC variant can be downloaded from PaperMC⁠. Move the jar file into the root server directory on the host and rename it paper-server.jar

⁠Build from source

⁠Bash

Creating the container:

create-mc-container.sh "FULL-PATH-TO-STORE-SERVER-ON-HOST"

Starting the container:

docker start mc

Stopping the container:

docker stop mc

Additionally, the server can be stopped, rebuilt, and started again.

rebuild-mc.sh "FULL-PATH-TO-STORE-SERVER-ON-HOST"
⁠PowerShell

Creating the container:

create-mc-container.ps1 "FULL-PATH-TO-STORE-SERVER-ON-HOST"

Starting the container:

docker start mc

Stopping the container:

docker stop mc

Additionally, the server can be stopped, rebuilt, and started again.

rebuild-mc.ps1 "FULL-PATH-TO-STORE-SERVER-ON-HOST"

⁠License

MIT License⁠

⁠Attributions

Spigot⁠

PaperMC⁠

⁠Special Thanks

Andrew Gu⁠

Tag summary

Content type

Image

Digest

Size

90 MB

Last updated

over 6 years ago

docker pull projectinitiative/apmc