docker-samples/diy-tunnel/private/docker-container/docker-compose.yml
2024-11-15 08:33:57 -07:00

27 lines
924 B
YAML

services:
wireguard:
image: lscr.io/linuxserver/wireguard:latest
hostname: THEPRIVATESERVER
cap_add:
- NET_ADMIN
environment:
- TZ=America/Edmonton
volumes:
- ./wg0.conf:/config/wg_confs/wg0.conf
restart: always
sysctls:
- net.ipv4.ip_forward=1
caddy:
image: caddy:latest
restart: always
# this is the special sauce. This attaches this container to the
# network context of the wireguard container. Essentially this means
# that Caddy is listening on 10.0.0.2 now.
# If you have other containers exposing additional ports, do the same to them.
network_mode: service:wireguard
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile # Mount Caddyfile for configuration
- ./webroot:/srv/www # Mount local www directory to container
- ./data/caddy:/data/caddy # Persistent storage for certificates