Skip to main content
team-collaboration/version-control/githubGithub

Minecraft Server with Docker Compose

Welcome to your personal Minecraft Server! This repository provides an easy-to-use setup for running a customizable Minecraft server using Docker Compose. Deploy it locally or to a virtual machine (VM) with minimal effort.

Table of Contents

  1. Description
  2. Quickstart
  3. Usage

Description

This repository offers a Docker Compose configuration for hosting a Minecraft server. The setup simplifies launching, managing, and customizing a Minecraft server.

Key features:

  • Containerized Deployment: Run your server reliably using Docker.
  • Customizable Settings: Adjust memory allocation, player limits, game modes, and more.
  • Easy Maintenance: Start, stop, and update your server with minimal effort.

Quickstart

Prerequisites

Ensure you have the following tools installed:

  • Docker
    • Docker Compose is included with Docker 20.10 and later. If you have an older version, follow the official instructions to install Docker Compose as a plugin.
  1. Clone this repository:

    git clone https://github.com/PascalNehlsen/minecraft-server
    cd minecraft-server
  2. Create a .env file from the example configuration:

    cp example.env .env
  3. Build and start the server container:

    docker compose up --build
  4. Open Minecraft and connect to the server:

    • Local server: localhost:8888 (or use your server's IP if hosted remotely).
  5. To stop the server, use:

    docker compose down

Usage

Configuration

The server settings can be customized in the example.env file. Below are the key environment variables you can modify:

VariableDescriptionDefault valuePossible Values
MAX_PLAYERSMaximum number of players allowed on the server.15Any integer value
MOTDMessage of the Day displayed to players upon joining.-Any text
DIFFICULTYDifficulty level of the server.easyeasy, normal, hard
GAMEMODEDefault game mode for players.creativesurvival, creative, adventure, spectator
ONLINE_MODEAuthenticate players using Minecraft's online services.truetrue, false