Skip to content

Running Gate in Docker

Gate ships in packaged Docker images that you can use to run Gate containers or base your own images on. You can also run it in Kubernetes.

Version Tags

You can use specific version tags instead of the latest. Every commit to the main branch is built and pushed to the latest tag as well as the commit's short SHA like 6d3671c.

docker run

sh
docker run -it --rm ghcr.io/minekube/gate:latest

This command will pull and run the latest Gate image.

  • -it - Run interactively and allocate a pseudo-TTY.
    • Alternatively using -d would run in detached mode.
  • --rm - Removes the container after it exits.

Mounting a config file

A complete config is located in repo config.yml.

sh
docker run -it --rm \
  -v PATH-TO-CONFIG/config.yml:/config.yml \
  ghcr.io/minekube/gate:latest

This command will pull and run the latest Gate image.

  • -v PATH-TO-CONFIG/config.yml:/config.yml - Mounts the config file from the host system into the container.

Mounting a config file and Minekube Connect token

sh
docker run -it --rm \
  -v PATH-TO-CONFIG/config.yml:/config.yml \
  -v PATH-TO-CONFIG/connect.json:/connect.json \
  ghcr.io/minekube/gate:latest

A Minekube Connect token json file can be automatically generated by running Gate with connect.enable: true in the config.

json
{"token":"YOUR-TOKEN"}

docker-compose.yaml

Copy the following snippet into a docker-compose.yaml file and run docker-compose up.

yaml
version: "3.9"

services:
  gate:
    image: ghcr.io/minekube/gate:latest
    container_name: gate
    restart: unless-stopped
    network_mode: host
    volumes:
    - PATH-TO-CONFIG/config.yml:/config.yml
    #- PATH-TO-TOKEN/connect.json:/connect.json

Running docker-compose down will stop and remove the containers.

We provide an example that configures Gate with two Minecraft servers.

sh
git clone https://github.com/minekube/gate.git
cd gate/.examples/docker-compose
docker-compose up

The files of the two servers are located in the serverdata* directories. You can join at localhost:25565 and use /server to switch between the servers.

Troubleshooting

If you see the following error:

sh
Unable to find image 'ghcr.io/minekube/gate:latest' locally
docker: Error response from daemon: Head "https://ghcr.io/v2/minekube/gate/manifests/latest": denied: denied.
See 'docker run --help'.

do

sh
docker logout ghcr.io

It may be because you are logged in to the GitHub Container Registry with an outdated personal access token (PAT). Simply logout or login with a new token. It's worse to provide a bad token than not to provide a token at all. GitHub sets tokens to expire after 30 days by default.

Released under the MIT License. (web version: da9f947d)