Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minecraft Server with Docker & mcstatus

📘 Table of Contents

  1. Introduction
  2. Prerequisites
  3. Project Structure
  4. Quickstart
  5. Usage and Configuration
  6. Verify Server Status
  7. Minimal docker-compose.yml
  8. Stop and Cleanup
  9. Contact
  10. Checklist

Introduction

This repository provides a minimal Docker-based setup for running a Minecraft server using Docker Compose. It demonstrates containerization, volume persistence, and external availability checks via mcstatus — without requiring the Minecraft game client or in-depth knowledge of the game itself.


Setup

Prerequisites

  • A V-Server running Ubuntu/Debian
  • Docker

Ensure your system is up to date:

sudo apt update && sudo apt install -y docker.io docker-compose git

Project Structure

minecraft-server/
├── docker-compose.yml
├── .gitignore
└── data/                # Automatically created when the server runs it includes all the server data including settings etcpp

Quickstart

  1. Install dependencies:
    sudo apt update && sudo apt install -y docker.io docker-compose git
  2. Clone the repository:
    git clone git@github.com:BenjaminTietz/minecraft-server.git
    cd mincraft-server
  3. Generate and configure the .env file:
    The environment file will be created automatically from env.template. Adjust the values to match your setup (optional):
    cp env_template.txt .env
    nano .env (optional)
  4. Start the Minecraft server:
    docker-compose up -d
  5. Install mcstatus and check server status:
    python -m pip install mcstatus
    mcstatus localhost:25565 status

Usage and Configuration

You can configure the server using environment variables in .env.

Default environment:

EULA: "TRUE" # Required to accept Minecraft EULA
MOTD: "Welcome to my server!" # Message of the Day

Volumes

All world data and configuration are persisted in the ./data folder:

volumes:
  - ./data:/data

Ports

The default Minecraft port is exposed:

ports:
  - "25565:25565"

For cloud deployments, you may map it to another port, e.g., 8888:25565.


Verify Server Status (without Minecraft client)

Install mcstatus:

python -m pip install mcstatus

Check server status:

mcstatus localhost:25565 status

Example output:

version: v1.21.5 (protocol 770)
motd: "A Minecraft Server"
players: 0/20 No players online

Minimal docker-compose.yml

services:
  minecraft-server:
    image: itzg/minecraft-server #This is an offical commuity image
    container_name: mc-server
    ports:
      - "25565:25565"
    environment:
      EULA: "TRUE" # (optional) use an .env
    volumes:
      - ./data:/data
    restart: on-failure

Stop and Cleanup

docker-compose down

To remove all persisted data:

rm -rf ./data

Contact

👤 Personal

🌍 Social

💻 Project Repository

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors