From 54027049d367fe0aacb3ae18223c209c5f75fb09 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 24 Jan 2021 12:31:56 -0600 Subject: [PATCH] docs: Added compose example to data attaching section --- README.md | 20 ++++++++++++++++++-- examples/docker-compose-simple.yml | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 66808883..8ca50289 100644 --- a/README.md +++ b/README.md @@ -116,8 +116,24 @@ to map a directory on your host machine to the container's `/data` directory, su docker run -d -v /path/on/host:/data ... -When attached in this way you can stop the server, edit the configuration under your attached `/path/on/host` -and start the server again with `docker start CONTAINERID` to pick up the new configuration. +When attached in this way you can stop the server, edit the configuration under your attached `/path/on/host` and start the server again with `docker start CONTAINER_ID` to pick up the new configuration. + +As example, using Docker compose, create the following `docker-compose.yml` in its own directory and the container will automatically create/attach the relative directory `data` to the container: + +```yaml +version: "3" + +services: + mc: + image: itzg/minecraft-server + ports: + - 25565:25565 + environment: + EULA: "TRUE" + volumes: + # attach the relative directory 'data' to the container's /data path + ./data:/data +``` ## Versions diff --git a/examples/docker-compose-simple.yml b/examples/docker-compose-simple.yml index dfaea2a5..afb7a35f 100644 --- a/examples/docker-compose-simple.yml +++ b/examples/docker-compose-simple.yml @@ -8,4 +8,5 @@ services: environment: EULA: "TRUE" volumes: + # attach the relative directory 'data' to the container's /data path ./data:/data