3

I am running netmaker which is a wireguard mesh VPN service on a Docker container, and I need port 9981 to be reachable from the Docker container, so that I can access port 9981 via my Wireguard WAN.

Port 9981 is open on the VPS on which Netmaker is hosted, but isn't reachable from within the Docker container. I have been trying to no avail to get this right, and I'm now at my wits end.

I was advised to add this line to my docker-container file which has just caused error after error -

PORT_FORWARD_SERVICES="127.0.0.1:9981:9981"

Please can someone assist.

Artur Meinild
  • 31,035

1 Answers1

2

Did you try the Docker documentation? Port forwarding is a pretty standard feature in Docker.

In a normal CLI syntax you add:

-p <host-port>:<container-port>

This is an example command that maps port 443:

docker run -d \
  --name=nextcloud \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Europe/London \
  -p 443:443 \
  -v /path/to/appdata:/config \
  -v /path/to/data:/data \
  --restart unless-stopped \
  lscr.io/linuxserver/nextcloud:latest

So you need to add -p 9981:9981 to the command you use to run your container.

There is also a similar syntax if you use Docker Compose (but since you didn't specify I assume this isn't the case).

Artur Meinild
  • 31,035