Creating a Minecraft Server for Offline and Online Play Using Docker

Requirements

  • ✅ A good internet connection for initial setup
  • ✅ Download Docker Desktop App
  • ✅ Minecraft Bedrock

Step by Step Guide to creating a LAN server you can play on any of your devices

  1. On any laptop connected to the same network as your minecraft device, create a folder minecraft-server
  2. Create a file docker-compose.yaml
  3. Copy and paste the following code into the docker-compose.yaml file
services:
  minecraft:
    image: itzg/minecraft-bedrock-server
    container_name: minecraft-bedrock
    environment:
      EULA: "TRUE"
      SERVER_NAME: "My Server"
      GAMEMODE: survival
      DIFFICULTY: normal
      ALLOW_CHEATS: "false"
      LEVEL_SEED: "7085862198572591177"
      ALLOW_LIST: "false"
    ports:
      - "19132:19132/udp"
    volumes:
      - ./minecraft-data:/data
    restart: unless-stopped

You can change the server name and other settings as needed.

  1. Right click inside the folder and select Open in Terminal or Open in Command Prompt

  2. Type the following command to initialise the docker container (Be sure to have Docker Desktop running)

docker-compose up

(Dont include -d so you can see the logs inside the terminal)

On the first run, the server will download the necessary files and start the server. You can check the logs until it says server started as shown on the image below:

Screenshot of CMD Terminal showing docker logs
  1. Open a cmd or powershell terminal and type the following command to get your local IP address
ipconfig

Look for soemthing like IPv4 Address. . . . . . : 192.168.1.100. It will be under: Wireless LAN adapter Wi-Fi you will see something like 192.168.100.4.

  1. On your Minecraft device, go to Play > Servers > Add Server and enter the following details:
  • Server Name: My Server
  • Server Address: [Your Local IP Address e.g. 192.168.1.100]
  • Port: 19132 (default port for Minecraft Bedrock)
  1. You should be able to connect to the server and play with friends on the same network.

  2. For offline play configuration set online-mode=false inside minecraft-data/server.properties file. This will allow you to play offline without needing an internet connection. (Note that an internet connection will still be needed to load minecraft to the servers menu)

Useful commands

docker exec minecraft-bedrock send-command gamerule showcoordinates true to set show coordinates

You can use AI to get other command variants

Managing the Server

I am in the process of creating a neat desktop app for you to manage the server. The app will allow you to start, stop, restart and view logs of the server. It will also allow you to change game settings without having to use the command line.