Use the Minecraft Spigot server as a Docker container
Project
master-branch (alias stable, latest)
develop-branch (alias nightly)
These instructions will cover usage information and for the docker container
In order to run this container you'll need docker installed.
docker run \
--rm \
-d \
-p 25565:25565 \
-v $(pwd)/spigot:/app \
-e JAVA_MAX_MEMORY=1G \
-e EULA=true \
--name spigot \
d3strukt0r/spigot
When configuring the server you HAVE TO either leave the server-ip
empty or use following option in your server.properties
file.
server-ip=0.0.0.0
However, this is done automatically when starting the server, so you can basically ignore this.
--rm
: Removes the container after it has been shut down. This means we can reuse the name later on.
-d
: Start detached. Or leave out to watch the logs. You can then leave using CTRL + D
-p 25565:25565
: This opens the internal port (inside the container) to the outer worlds. You can open as many ports as you want. This would maybe look like -p 25565:25565 -p 8192:8192
.
-v $(pwd)/spigot:/app
: If you want to save your server somewhere, you need to link the directory inside your container to your host. Before the colon goes the place on your host. After the colon goes the directory inside the container, which is always /app
.
-e JAVA_MAX_MEMORY=1G
: This is the equivalent of -Xmx1G
. For the required amount of RAM you will need, please consult Google.
--name spigot
: Give the container a name, for easier referencing later on.
d3strukt0r/spigot
: This is the repository where the container is maintained. You can also specify what version you want to use. e. g. d3strukt0r/spigot:latest
or d3strukt0r/spigot:1.8
. For all versions check the Tags on Docker Hub.
While running you can access the output with docker logs -f <container name>
and leave with CTRL + Q
.
-f
: To not just output the logs until now, but keep reading, until we exit with CTRL + D
. This will not close the server, you'll just leave the logs.
To send a command through the console to Spigot, use docker exec <container name> console "<command>"
.
Replace <command>
with the command you need. This is what you would also usually enter
inside your regular console, like e. g. op D3strukt0r
.
At the end to shut everything down use docker stop <container name>
Create a file called docker-compose.yml
version: "2"
services:
spigot:
image: d3strukt0r/spigot
ports:
- 25565:25565
networks:
- internal
dns:
- 1.1.1.1
- 1.0.0.1
volumes:
- ./spigot:/app
environment:
- JAVA_MAX_MEMORY=1G
- EULA=true
networks:
internal:
external: false
To start the server use docker-compose up
or docker-compose up -d
for starting detached (in the background). When running without -d
, you can still detach with CTRL + P
followed by CTRL + Q
.
While running you can access the output with docker-compose logs -f
and leave with CTRL + Q
.
To send a command through the console to Spigot, use docker-compose exex <container name> console "<command>"
.
At the end to shut everything down use docker-compose down
All environment variables support Docker Secrets. To learn more about Docker Secrets, read here.
Basically, after creating a secret, append a _FILE
(e. g. JAVA_OPTIONS_FILE
) after the environment variable and set the path to something like /run/secrets/<something>
.
JAVA_MEMORY
- The memory java can use. Any integer followed byK
(Kilobyte),M
(Megabyte) orG
(Gigabyte) (Default:512M
)JAVA_BASE_MEMORY
- The memory java can use at startup. Any integer followed byK
(Kilobyte),M
(Megabyte) orG
(Gigabyte) (Default:${JAVA_MEMORY}
)JAVA_MAX_MEMORY
- The maximum memory the application can use. Recommended is512M
for each 500 users. Any integer followed byK
(Kilobyte),M
(Megabyte) orG
(Gigabyte) (Default:${JAVA_MEMORY}
)JAVA_OPTIONS
- Anyjava
argument (Default: )EULA
- Accept EULA before Spigot asks for it, for a smooth startup.true
to agree,false
otherwise (Default:false
)BUNGEECORD
- Change the settings, so that bungeecord can be used.true
to set up configs optimally for BungeeCord,false
otherwise (Default:false
)
/app
- All the data, like: configs, plugins, logs, icons
/usr/local/bin/console
- Can send a command to Spigot indirectly/usr/local/bin/interactive-console
- The console used after Spigot has started (So you can still run commands inside the console)
- OpenJDK - The Java conatainer in Docker
- Spigot - The main software
- Github Actions - Automatic CI (Testing) / CD (Deployment)
- Docker - Building a Container for the Server
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
There is no versioning in this project. Only the develop for nightly builds, and the master branch which builds latest and all minecraft versions.
- Manuele Vaccari - D3strukt0r - Initial work
See also the list of contributors who participated in this project.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE.txt file for details.
- Kjell Havnesköld with nimmis/docker-spigot
- Sylvain CAU with AshDevFr/docker-spigot
- Hat tip to anyone whose code was used
- Inspiration
- etc