Skip to content

Instantly share code, notes, and snippets.

@andrewginns
Created May 13, 2024 10:34
Show Gist options
  • Save andrewginns/ebbda325c5532113955414f40fb8796f to your computer and use it in GitHub Desktop.
Save andrewginns/ebbda325c5532113955414f40fb8796f to your computer and use it in GitHub Desktop.
Create a nordVPN-meshnet service that's accessible on any meshnet device
services:
meshnet:
image: ghcr.io/mattstechinfo/meshnet:latest
networks:
app-meshnet:
ipv4_address: 172.20.0.2
restart: unless-stopped
cap_add:
- NET_ADMIN
- NET_RAW
env_file: .env
hostname: meshnet
# This command setup redirects traffic to the meshnet-service container, then proceeds with the original meshnet startup sequence.
command: >
/bin/sh -c "
iptables -t nat -A PREROUTING -p tcp --dport 3000 -j DNAT --to-destination 172.40.0.3:3000 &&
iptables -t nat -A POSTROUTING -j MASQUERADE &&
nordvpn_login && meshnet_config && meshnet_watch
"
meshnet-service:
image: new-service-container:latest
env_file: .env
ports:
- "3000:3000"
networks:
app-meshnet:
ipv4_address: 172.20.0.3
depends_on:
- meshnet
networks:
app-meshnet:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16
@danpicton
Copy link

Thanks - I suspected so. Still trying to bend this example to my use case, but hopefully not far off 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment