How to Route Any Docker Container Through NordVPN (macOS Friendly)
This guide shows you how to run NordVPN in Docker and force other containers to use it for all their internet traffic.
This is the correct method for macOS using Docker Desktop. If you need the Windows version of this, click here.
What You’re Doing (in plain English)
You will:
- Run one container that connects to NordVPN
- Run other containers that “piggyback” on that VPN container
- Those containers will now appear on the internet as NordVPN IPs
Click to download the ZIP of the Docker files
Click For Special NordVPN Deal
PRE-STEP – Get NordVPN Service Credentials
If you’re running NordVPN in Docker (or using OpenVPN/WireGuard manually), you do NOT use your email + password.
You must use Nord’s Service Credentials.
These are separate, special credentials designed specifically for:
- OpenVPN
- WireGuard / NordLynx
- Routers
- Docker containers
- Manual setups
Step 1 – Log Into Your Nord Account
Go to:
Log in with your normal Nord email + password.

Step 2 – Go to “Set Up NordVPN Manually”
Once logged in:
- Click NordVPN
- Click Set up NordVPN manually
You are now on the page that shows Service credentials.

Step 3 – Copy Your Service Username & Password


You will see two fields:
- Username (looks like random letters/numbers, not your email)
- Password (random string)
These are your service credentials.
👉 Copy both of them.
👉 These are what Docker / OpenVPN will use.

Do NOT use:
- your email
- your Nord website password
They will not work.
Step 4 – Paste Them Into Your .env File
Open the .env file in the starter pack and paste:
Example:
Save the file.
Your government, Internet Service Provider, app/addon/IPTV developers, and all websites document and record your online activity through your identifying IP address.
Your Current Identifying IP Address (digital fingerprint): 18.97.14.83
Browse anonymously by using NordVPN
TODAY’S DEAL
SAVE 72% ON NORDVPN + 3 FREE MONTHS
NordVPN backs their service with a 30-day money-back guarantee
Use your account on 10 devices with blazing fast speeds & thousands of servers
CLAIM NORDVPN DISCOUNT
Step 1 – Set Up the VPN Container
This container:
- connects to NordVPN
- creates the encrypted tunnel
- becomes the “internet gateway” for other containers
Step 2 – Add Your App Container
Any container you want to route through the VPN gets this line:
That is the entire magic.
Example:
Now:
-
myappdoes not use your real IP -
it uses the NordVPN connection from
gluetun
Step 3 – Start Everything
From the folder with docker-compose.yml:
That’s it.
No extra networking.
No firewall rules.
No proxies.
No hacks.
Step 4 – Verify It’s Working
To confirm traffic is going through NordVPN:
If the IP is:
-
not your home IP
-
shows a different country
Then it’s working.
Every container using network_mode: container:gluetun will have the same VPN IP.
Click For Special NordVPN Deal
Important Rules (Read This Once)
1. You do NOT expose ports on the app container
This is wrong:
It will not work.
2. You expose ports on the VPN container
This is correct:
Because:
-
the app shares the VPN container’s network
-
all traffic goes through gluetun
3. They share localhost
Inside the VPN container:
…will hit your app.
Because they are literally sharing the same network stack.
Example: Real-World Pattern
Node API behind VPN
Scraper behind VPN (no ports)
Mental Model (This Makes It Click)
Think of it like this:
Your app:
-
cannot touch the internet directly
-
is forced to go through the VPN container
That is why this method is clean, safe, and leak-proof.
