Docker runs applications in lightweight, isolated containers. If you install NordVPN inside a container, its internet connection is encrypted through NordVPN's servers.
Prepare
- Install Docker Engine on Linux and open the Terminal.
- Create a folder for the image and go into it:
mkdir nordvpn-docker && cd nordvpn-docker - Create and open a Dockerfile (here with nano):
nano Dockerfile - Paste the following:
FROM ubuntu:24.04
RUN apt-get update && \
apt-get install -y --no-install-recommends wget apt-transport-https ca-certificates && \
wget -qO /etc/apt/trusted.gpg.d/nordvpn_public.asc https://repo.nordvpn.com/gpg/nordvpn_public.asc && \
echo "deb https://repo.nordvpn.com/deb/nordvpn/debian stable main" > /etc/apt/sources.list.d/nordvpn.list && \
apt-get update && \
apt-get install -y --no-install-recommends nordvpn && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ENTRYPOINT /etc/init.d/nordvpn start && sleep 5 && /bin/bash -c "$@"
CMD bash
Save and exit with Ctrl + X, then Y and Enter.
Build and run the image
- In the same folder, build the image (don't forget the dot at the end):
sudo docker build -t nordvpn-image . - Run it:
sudo docker run -it --hostname mycontainer --cap-add=NET_ADMIN --sysctl net.ipv6.conf.all.disable_ipv6=0 nordvpn-image - Inside the container, log in with a token, then connect to a server:
nordvpn login --token <your token>nordvpn connect
You create the token in your Nord Account, in the NordVPN section.
What the options do
-it: opens an interactive bash shell inside the container.--cap-add=NET_ADMIN: required for the NordVPN service to run and connect to servers.--sysctl net.ipv6.conf.all.disable_ipv6=0: sets the container's IPv6 so NordVPN controls IPv6 traffic and nothing leaks after you connect.--hostname: a fixed name for the container, so its Meshnet name doesn't change after a restart.
Every NordVPN Linux command also works inside the container.