Skip to content

D3strukt0r/docker-spigot

docker-spigot

Use the Minecraft Spigot server as a Docker container

Project

License Docker Stars Docker Pulls

master-branch (alias stable, latest)

GH Action CI/CD Codacy grade

develop-branch (alias nightly)

GH Action CI/CD Codacy grade

Getting Started

These instructions will cover usage information and for the docker container

Prerequisities

In order to run this container you'll need docker installed.

Usage

Starting a server

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.

Reading the logs

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.

Sending commands

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.

Stopping the server

At the end to shut everything down use docker stop <container name>

Using Docker Compose (docker-compose.yml)

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
Compose: Starting a server

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.

Compose: Reading the logs

While running you can access the output with docker-compose logs -f and leave with CTRL + Q.

Compose: Sending commands

To send a command through the console to Spigot, use docker-compose exex <container name> console "<command>".

Compose: Stopping the server

At the end to shut everything down use docker-compose down

Environment Variables

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 by K (Kilobyte), M (Megabyte) or G (Gigabyte) (Default: 512M)
  • JAVA_BASE_MEMORY - The memory java can use at startup. Any integer followed by K (Kilobyte), M (Megabyte) or G (Gigabyte) (Default: ${JAVA_MEMORY})
  • JAVA_MAX_MEMORY - The maximum memory the application can use. Recommended is 512M for each 500 users. Any integer followed by K (Kilobyte), M (Megabyte) or G (Gigabyte) (Default: ${JAVA_MEMORY})
  • JAVA_OPTIONS - Any java 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)

Volumes

  • /app - All the data, like: configs, plugins, logs, icons

Useful File Locations

  • /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)

Built With

  • OpenJDK - The Java conatainer in Docker
  • Spigot - The main software
  • Github Actions - Automatic CI (Testing) / CD (Deployment)
  • Docker - Building a Container for the Server

Find Us

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

There is no versioning in this project. Only the develop for nightly builds, and the master branch which builds latest and all minecraft versions.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE.txt file for details.

Acknowledgments

About

Spigot in a Docker container

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published