From 3370b317891362a06fa48445499bc1f97de9ff71 Mon Sep 17 00:00:00 2001 From: Max Moir <63592337+archessmn@users.noreply.github.com> Date: Sun, 20 Aug 2023 19:22:48 +0100 Subject: [PATCH] Update README.md to add Docker Compose instructions --- README.md | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e841aff3..9d9e7c9e 100644 --- a/README.md +++ b/README.md @@ -47,11 +47,11 @@ And log in again. To automatically install & run wg-easy, simply run: -
+```shell
 $ docker run -d \
   --name=wg-easy \
-  -e WG_HOST=🚨YOUR_SERVER_IP \
-  -e PASSWORD=🚨YOUR_ADMIN_PASSWORD \
+  -e WG_HOST=🚨YOUR_SERVER_IP \
+  -e PASSWORD=🚨YOUR_ADMIN_PASSWORD \
   -v ~/.wg-easy:/etc/wireguard \
   -p 51820:51820/udp \
   -p 51821:51821/tcp \
@@ -61,7 +61,34 @@ $ docker run -d \
   --sysctl="net.ipv4.ip_forward=1" \
   --restart unless-stopped \
   weejewel/wg-easy
-
+``` + +Or to use Docker Compose ([installation](https://docs.docker.com/compose/install/)), create the file `docker-compose.yml` with the following contents: + +```yaml +version: '3.3' +services: + wg-easy: + container_name: wg-easy + environment: + - WG_HOST=🚨YOUR_SERVER_IP + - PASSWORD=🚨YOUR_ADMIN_PASSWORD + volumes: + - '~/.wg-easy:/etc/wireguard' + cap_add: + - NET_ADMIN + - SYS_MODULE + sysctls: + - net.ipv4.conf.all.src_valid_mark=1 + - net.ipv4.ip_forward=1 + ports: + - '51820:51820/udp' + - '51821:51821/tcp' + restart: unless-stopped + image: weejewel/wg-easy +``` + +and then run `$ docker compose up -d` in the same directory as the file you just created. > 💡 Replace `YOUR_SERVER_IP` with your WAN IP, or a Dynamic DNS hostname. > @@ -77,7 +104,7 @@ Are you enjoying this project? [Buy me a beer!](https://github.com/sponsors/WeeJ ## Options -These options can be configured by setting environment variables using `-e KEY="VALUE"` in the `docker run` command. +These options can be configured by setting environment variables using `-e KEY="VALUE"` in the `docker run` command or by adding additional lines in the format `- KEY=VALUE` in the `environment` section if using Compose. | Env | Default | Example | Description | | - | - | - | - | @@ -107,7 +134,7 @@ docker rm wg-easy docker pull weejewel/wg-easy ``` -And then run the `docker run -d \ ...` command above again. +And then run the `docker run -d \ ...` command above again. Alternatively, if using Docker Compose navigate to the folder containing your `docker-compose.yml` file and run `$ docker compose up`. ## Common Use Cases