DEV Community

Cover image for Installing a VPN Server with Docker on Proxmox โ€“ The Ultimate Guide
Fedya
Fedya

Posted on

Installing a VPN Server with Docker on Proxmox โ€“ The Ultimate Guide

๐Ÿš€ Installing a VPN Server with Docker on Proxmox โ€“ The Ultimate Guid


๐Ÿง  Why Run a VPN in Docker on Proxmox?

Running a VPN server is often a first step toward building a secure self-hosted infrastructure. But when you combine:

  • ๐Ÿงฉ Docker โ€“ for modular, reproducible environments,
  • ๐Ÿงฑ Proxmox VE โ€“ for rock-solid virtualization and LXC containers,
  • ๐Ÿ”’ VPN โ€“ for encrypted access to your internal network,

...you get a powerful, portable, and private network layer under your full control.


๐Ÿ“‹ What Weโ€™ll Cover

  • ๐Ÿ› ๏ธ Requirements & Environment
  • โš™๏ธ Setting up the Proxmox environment
  • ๐Ÿ“ฆ Deploying a Docker container
  • ๐Ÿ” Installing the VPN server (WireGuard or OpenVPN)
  • ๐ŸŒ Accessing your VPN and testing
  • ๐Ÿงฐ Tips, tricks & troubleshooting

Letโ€™s dive in!


๐Ÿงฐ Requirements

Before we start, hereโ€™s what youโ€™ll need:

โœ… Item ๐Ÿ”Ž Details
๐Ÿ–ฅ๏ธ Proxmox VE Version 7.x or newer
๐Ÿ“ฆ Docker Installed inside an LXC container or VM
๐ŸŒ Public IP For remote VPN access
๐Ÿ” Port forwarding On your router, if behind NAT
๐Ÿง‘โ€๐Ÿ’ป Basic Linux skills Just a bit helps a lot

๐Ÿ—๏ธ Step 1: Create a Proxmox Container or VM

You can run Docker inside a Debian-based LXC container or a Proxmox VM. For simplicity and performance, weโ€™ll go with an LXC container.

๐Ÿ”ง Create LXC Container (Debian-based)

  1. Go to Proxmox Web UI
  2. Click โž• Create CT
  3. Choose:
    • Template: debian-12-standard_*.tar.zst
    • Disk size: 8GB+
    • Network: Bridged or NAT
  4. Click Finish, then Start the container

๐Ÿณ Step 2: Install Docker

๐Ÿง Log into the container:

pct enter <container_id>
Enter fullscreen mode Exit fullscreen mode

๐Ÿ”„ Update packages:

apt update && apt upgrade -y
Enter fullscreen mode Exit fullscreen mode

๐Ÿ“ฅ Install Docker:

curl -fsSL https://get.docker.com | sh
Enter fullscreen mode Exit fullscreen mode

Test it:

docker run hello-world
Enter fullscreen mode Exit fullscreen mode

Congrats ๐ŸŽ‰ โ€” Docker is running inside your container!


๐Ÿ” Step 3: Deploy a VPN Server (WireGuard)

โœ… Why WireGuard?

WireGuard is blazing fast, secure, and easy to configure.

๐Ÿงฑ Create a Docker volume (optional but recommended):

docker volume create wg_data
Enter fullscreen mode Exit fullscreen mode

๐Ÿš€ Run WireGuard container:

Weโ€™ll use the excellent linuxserver/wireguard image.

docker run -d   --name=wireguard   --cap-add=NET_ADMIN   --cap-add=SYS_MODULE   -e PUID=1000   -e PGID=1000   -e SERVERURL=your.domain.com   -e SERVERPORT=51820   -e PEERS=3   -e PEERDNS=1.1.1.1   -e INTERNAL_SUBNET=10.13.13.0   -v wg_data:/config   -v /lib/modules:/lib/modules   -p 51820:51820/udp   --sysctl="net.ipv4.conf.all.src_valid_mark=1"   --restart unless-stopped   lscr.io/linuxserver/wireguard:latest
Enter fullscreen mode Exit fullscreen mode

๐Ÿ” Replace your.domain.com with your actual domain or public IP.

After a few seconds, the container will auto-generate peer configs. ๐ŸŽฏ


๐Ÿ“ฒ Step 4: Access & Use the VPN

To access client configs:

docker exec -it wireguard cat /config/peer1/peer1.conf
Enter fullscreen mode Exit fullscreen mode

๐Ÿ“ฑ Import this into the WireGuard app on iOS, Android, Windows, or Linux.

๐Ÿ“ก Open the port on your router:

Forward UDP 51820 to your Proxmox host (or container) IP.


๐Ÿงช Step 5: Test Your VPN

On your phone or laptop:

  1. Connect to Wi-Fi (external to your server)
  2. Start the WireGuard VPN
  3. Visit https://whatismyipaddress.com
  4. It should now show your serverโ€™s public IP ๐ŸŒ

Congratulations, you're browsing via your own secure VPN! ๐ŸŽ‰๐Ÿ”


๐Ÿง  Bonus: OpenVPN Alternative (Optional)

Prefer OpenVPN?

Use the linuxserver/openvpn-as Docker image instead:

docker run -d   --name=openvpn-as   -e PUID=1000   -e PGID=1000   -e TZ=Europe/Sofia   -p 943:943   -p 9443:9443   -p 1194:1194/udp   -v ovpn_data:/config   --cap-add=NET_ADMIN   --restart unless-stopped   lscr.io/linuxserver/openvpn-as:latest
Enter fullscreen mode Exit fullscreen mode

Then access it at https://<server-ip>:943.


๐Ÿ› ๏ธ Troubleshooting Tips

โ— Issue ๐Ÿงฉ Solution
VPN not connecting Check port forwarding, firewall, or docker network
No internet via VPN Check net.ipv4.ip_forward=1 and routing
DNS leaks Set proper PEERDNS or use encrypted DNS

๐Ÿงฉ Useful Extras


๐Ÿ’ฌ Final Thoughts

Setting up your own VPN server with Docker under Proxmox combines the best of virtualization, containerization, and privacy.

  • ๐Ÿ’ก For beginners โ€” this setup builds confidence.
  • โš™๏ธ For experts โ€” it's the foundation for more advanced self-hosted networks.

If you found this guide helpful, feel free to leave a comment or follow for more DevOps and self-hosting tutorials! ๐Ÿš€


๐Ÿ™Œ Stay safe, stay private, and keep building! ๐Ÿ‘จโ€๐Ÿ’ป๐Ÿ‘ฉโ€๐Ÿ’ป


Written with โค๏ธ by [Your Name] for the Dev.to community.

Top comments (0)