Git Product home page Git Product logo

spigot-docker's Introduction

Spigot Minecraft Server in Docker

Easily build & start Spigot Minecraft server in a container. No need to manually setup your server environment.

Prerequisite

  1. Docker with Docker Compose ๐Ÿณ

That's all you need!

Usage

You may need to get familiar with Docker before using it (which is easy!). Here is steps for building and running Spigot Minecraft server.

  1. Clone this project.
  2. Go the the project folder and edit Spigot properties as you preferred in spigot-variables.env. Note that you may need to agree Minecraft EULA to be able to run the server.
  3. Create an empty folder called mcdata in the project folder. All Spigot files will be generated inside this folder after run the server.
  4. Run the following command to build and start Spigot Minecraft server.
docker-compose up -d

The above command creates a docker container called spigot and run it in background. Also, the command start building before run the server if the image hasn't been built yet.

  1. Enjoy ๐ŸŽ‰

spigot-variables.env

EULA: The agreement status for Minecraft EULA. Can be either true or false. The EULA is agreed if the value is true. Otherwise, the value is false. In order to run Spigot Minecraft server, The Minecraft EULA need to be agreed.

START_RAM_USAGE: The beginning amount of RAM used by the server. After started the server, the amound of RAM allocated will not be lower than this value. The example syntax of the value is as follow.

# "2G" means 2 Gigabytes.
START_RAM_USAGE=2G

# "2M" means 2 Megabytes.
START_RAM_USAGE=2M

MAX_RAM_USAGE: The maximum amount of RAM used by the server. The server will not allocate RAM more than this specified value. The syntax is the same as START_RAM_USAGE.

Note that these properties are environment variables inside the Spigot's container. Feel free to provide the variables in different ways.

Update Spigot Version

In order to update or change Spigot version, rebuild Docker image is required, so that build tools can be updated. The command is as follow.

docker-compose build --build-arg version=<your_preferred_version>

The command above rebuild the entire Docker image with disabling cache, so that build tool and other necessary files are newly downloaded from the internet. preferred version can also be specified as properties for building the image. Replace <your_preferred_version> to your preferred version of Spigot server e.g. 1.14.2.

However, if build tool need to be updated but still use the same version of server, please add another build argument like this

docker-compose build \
--build-arg version=<your_preferred_version> \
--build-arg revision=<your arbitrary build version>

Replace <your arbitrary build version> to any value that is different from the previous build. For example, if your previous biuld doesn't provide revision argument, then you can use revision argument with any value as you like. However, if your previous build used 1234 as the revision argument, the current build should have different revision value like 1235, or omit the declaration of revision argument.

Manipulate Server Files

In order to add plugins, datapacks, or modify server.properties, these files can be found in mcdata folder that you already created in project root folder.

Access Server Console

Accessing Spigot server console can be done with the following command

docker attach spigot-docker_spigot_1

This command attach your terminal to container's terminal, so that the server console can be used. Press Ctrl+P followed by Ctrl+Q to exit the container terminal. Note that exit the container terminal doesn't stop the server. The terminal can be accessed again using docker attach command.

For those who are using Docker for Mac

MacOS uses different mechanism of file system, which may decrease the performance of mounting volume when mounted to linux container. Therefore, we reccommended to put :delegated tag at the end of volumes in docker compose file to increase performance, like this:

volumes:
  - ./mcdata/:/data:delegated

Other useful instructions (Docker commands)

Start & stop the existing container

docker start <container name>
docker stop <container name>

Delete the stopped container. Game files will not be deleted

docker rm <container name>

Use Minecraft console inside the container. Note that the previous logs won't be displayed.

docker attach <container name>

Exit after attached the container, type:

Ctrl+P, Ctrl+Q

View server logs. Add -f before spg to stream the new log and type Ctrl+C to quit

docker logs spg

Copy files from the container to host

docker cp spg:/mcserver mcserver

Copy files from the host to the container (Example)

docker cp mcserver/world spg:/mcserver/world

Credits

Made with โค๏ธ by Nathachai Jaiboon.

spigot-docker's People

Contributors

ntchjb avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

spigot-docker's Issues

Invalid docker-compose.yml

This is what I get when running docker-compose up -d

WARNING: The PORT variable is not set. Defaulting to a blank string.
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.spigot.ports contains an invalid type, it should be a number, or an object

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.