From a12da9a18925ae53ef4e526e793fedac8e13c8c8 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 15 Jun 2023 21:25:35 +0000 Subject: [PATCH] docs: add docker compose usage to intro --- docs/index.md | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/docs/index.md b/docs/index.md index 5f130e2944a..791fd2b6114 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,5 @@ ---- -title: Intro ---- +# Intro + [![Docker Pulls](https://img.shields.io/docker/pulls/itzg/minecraft-server.svg)](https://hub.docker.com/r/itzg/minecraft-server/) [![Docker Stars](https://img.shields.io/docker/stars/itzg/minecraft-server.svg?maxAge=2592000)](https://hub.docker.com/r/itzg/minecraft-server/) [![GitHub Issues](https://img.shields.io/github/issues-raw/itzg/docker-minecraft-server.svg)](https://github.com/itzg/docker-minecraft-server/issues) @@ -31,3 +30,34 @@ where, in this case, the standard server port 25565, will be exposed on your hos **DO NOT** port forward RCON on 25575 without first setting `RCON_PASSWORD` to a secure value. It is highly recommended to only use RCON within the container, such as with `rcon-cli`. By default, the container will download the latest version of the "vanilla" [Minecraft: Java Edition server](https://www.minecraft.net/en-us/download/server) provided by Mojang. The [`VERSION`](versions/java.md) and the [`TYPE`](types-and-platforms/) can be configured to create many variations of desired Minecraft server. + +## Using [Docker Compose](https://docs.docker.com/compose/) + +1. Create a new directory +2. Put the contents of the file below in a file called `docker-compose.yml` +3. Run `docker compose up -d` in that directory +4. Done! Point your client at your host's name/IP address and port 25565. + +```yaml +version: "3.8" + +services: + mc: + image: itzg/minecraft-server + tty: true + stdin_open: true + ports: + - "25565:25565" + environment: + EULA: "TRUE" + volumes: + # attach the relative directory 'data' to the container's /data path + - ./data:/data +``` + +To apply changes made to the compose file, just run `docker compose up -d` again. + +Follow the logs of the container using `docker compose logs -f`, check on the status with `docker compose ps`, and stop the container using `docker compose stop`. + +!!! note "More Examples" + There are more [examples located in the Github repo](https://github.com/itzg/docker-minecraft-server/tree/master/examples). \ No newline at end of file