DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk9 min

OpenVPN Docker Compose Setup on a VPS: Step-by-Step

A practical, current-syntax guide to running OpenVPN in Docker Compose on a Linux VPS, including persistent storage, CA setup, client profiles, firewall checks and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can run an OpenVPN server on a Linux VPS with Docker Compose by combining the kylemanna/openvpn image, the container’s NET_ADMIN capability, UDP port 1194, and persistent storage for the OpenVPN PKI and configuration. The deployment is completed in separate one-time commands: generate the server configuration, initialize the certificate authority (CA), start the service, create a certificate for each client, and export each client’s .ovpn profile.

This guide uses current docker compose syntax. Before deploying, check the project repository for a supported image tag and any changed commands; the image tag, documentation and Compose behavior are version-sensitive.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What you are building

The VPS runs a single OpenVPN service inside a Docker container. Docker publishes UDP port 1194 on the VPS to UDP port 1194 in the container, while the container receives NET_ADMIN so OpenVPN can create and manage the tunnel interface and routing rules it needs. A persistent directory is mounted at /etc/openvpn; this is where the server configuration, private keys, certificates and client material live.

Every device that connects needs its own client certificate and exported profile. The profile is a self-contained .ovpn file containing the CA certificate, that client’s certificate and private key, and the connection settings. Treat it like a password: anyone who obtains a usable profile may be able to connect as that client.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Prerequisites and decisions

  • A Linux VPS with a public IP address. Clients must be able to reach the VPS from the internet. If you use a hostname, its DNS record must resolve to the VPS.
  • Docker Engine and the Docker Compose plugin. This guide uses the current docker compose subcommand, not the older hyphenated docker-compose executable.
  • Inbound UDP 1194. Allow this port in the VPS provider’s network firewall and in the operating system firewall. OpenVPN can use another port, but the commands below follow the documented UDP 1194 setup.
  • SSH access and administrative privileges. You will create files, run containers and inspect logs.
  • A secure place for secrets and backups. You will set a CA passphrase and, normally, a passphrase for every client private key. Losing the CA passphrase prevents you from signing additional certificates with that PKI.

The project documentation does not establish a universal minimum RAM or CPU requirement. Do not treat unverified claims such as a particular 512 MB minimum as a guarantee; choose a VPS according to the number of simultaneous users, encryption workload and the rest of the software running on it.

Open the network path

First allow UDP 1194 in your provider’s firewall. Then configure the distribution firewall using its own documented syntax. For a system that uses UFW, the commonly shown example is:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo ufw allow 1194/udp

This is an example rather than a distribution-independent requirement. Confirm the rule with your operating system’s firewall tools and make sure the provider-level firewall is not still blocking the port.

Create the Compose project

Connect to the VPS and create a dedicated directory. Keeping the Compose file and the persistent data directory together makes backups and upgrades easier.

mkdir -p ~/openvpn-docker/openvpn-data/conf
cd ~/openvpn-docker

Create docker-compose.yml with a pinned image tag. Replace the value inside <PINNED_TAG> with a tag currently documented by the project; do not silently switch to latest if reproducible upgrades matter.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
services:
  openvpn:
    image: kylemanna/openvpn:<PINNED_TAG>
    cap_add:
      - NET_ADMIN
    ports:
      - "1194:1194/udp"
    volumes:
      - ./openvpn-data/conf:/etc/openvpn

The important settings are:

Compose setting Purpose
image Runs the kylemanna OpenVPN image. Pin a specific tag after checking the repository.
cap_add: NET_ADMIN Grants the networking capability OpenVPN needs inside the container.
1194:1194/udp Publishes the VPS’s UDP 1194 to the container’s UDP 1194.
./openvpn-data/conf:/etc/openvpn Persists the PKI, keys and configuration on the VPS instead of leaving them only in the container’s writable layer.

The project’s older examples may include a top-level version: '2' key and use docker-compose. Current Compose does not require the version key, and the commands in this guide use docker compose.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Generate the server configuration

Run the image’s configuration generator once. Substitute the VPS’s public IP address or a DNS name that points to it.

docker compose run --rm openvpn ovpn_genconfig -u udp://YOUR_SERVER_OR_DOMAIN

docker compose run --rm starts a temporary container for the command and removes that container afterward. The generated files remain because /etc/openvpn is mounted to the persistent host directory. The udp:// prefix and the address must match how clients will reach the server. If you later change the public address, regenerate or edit the configuration deliberately and issue profiles that contain the correct endpoint.

Initialize the certificate authority

Create the CA and the initial public-key infrastructure with:

docker compose run --rm openvpn ovpn_initpki

The command asks you to create and confirm a CA passphrase. Record it in an offline password manager or another protected location. This passphrase protects the authority that signs client certificates; it is not the same thing as a client’s connection password. Anyone who can use the CA private key and its passphrase can sign new credentials, so restrict access to the mounted openvpn-data/conf directory and its backups.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Start the OpenVPN container

Start the service in the background:

docker compose up -d openvpn

Immediately inspect the startup output:

docker compose logs -f openvpn

Press Ctrl+C to stop following the log; it does not stop the container. In a separate shell, check the service state:

docker compose ps

A running container alone does not prove that an internet client can connect. Confirm that UDP 1194 is allowed at both firewall layers and that the address embedded in the generated configuration resolves to this VPS.

Create a certificate for each client

Issue a unique certificate and key for every phone, laptop, router or user. Use a descriptive name such as alice-laptop or office-router; avoid spaces and reuse of names.

docker compose run --rm openvpn easyrsa build-client-full CLIENTNAME

The command prompts for the CA passphrase and, by default, asks you to protect the client private key with its own passphrase. The project documentation recommends keeping that protection and advises against the nopass option. A key passphrase means a stolen profile file is less useful without the additional secret, although it also means the client application must be able to request the passphrase when connecting.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Repeat the command with a different name for every client. Do not copy one person’s certificate to multiple devices when you need per-device accountability or the ability to remove one device without replacing everyone else’s credentials.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Export the client .ovpn profile

After creating a certificate, export the complete profile to a file on the VPS:

docker compose run --rm openvpn ovpn_getclient CLIENTNAME > CLIENTNAME.ovpn

For example, a client named alice-laptop produces alice-laptop.ovpn. The generated file bundles the CA certificate, the client certificate, the private key and the connection settings, so the client application does not need separate certificate files.

Transfer the file over a channel you trust, such as an encrypted file-transfer session or an end-to-end encrypted vault. Do not post it in a public issue, paste site or unencrypted shared folder. Remove temporary copies from shell-history-visible locations and shared directories when they are no longer needed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Import and test a client

  1. Install an OpenVPN-compatible client on the target device from a source you trust.
  2. Use the client’s import function to open the exported .ovpn file.
  3. Enter the client-key passphrase if the application asks for it.
  4. Connect while the device is on a network outside the VPS’s local network, such as cellular data or another internet connection.
  5. Watch the server log during the first test with docker compose logs -f openvpn. A successful session should produce a client connection in the log; the exact wording varies by image version.

If the profile imports but cannot connect, test the endpoint and firewall before recreating certificates. A wrong DNS record, blocked UDP 1194 or a server that is not running causes the same user-visible symptom as many configuration errors.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Back up the persistent data safely

The directory mounted at ./openvpn-data/conf contains the material that makes this installation identifiable: the server configuration, CA, issued certificates and private keys. Back it up in encrypted storage with access limited to the administrators who need it. A backup without the CA passphrase may not let you issue new clients, while a backup exposed together with the passphrase can compromise the entire PKI.

Before an image upgrade, copy the directory and keep the existing Compose file and image tag documented. Test changes with a maintenance window and retain a rollback copy. Never delete the persistent directory as a way to “reset” a broken container unless you intentionally want to destroy the server’s certificates and start a new PKI.

Troubleshoot common failures

The container exits immediately

Read the complete log rather than repeatedly restarting:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
docker compose logs openvpn

Check that the image tag exists, the YAML indentation is valid, NET_ADMIN is present, and the mounted directory is writable by the container. For additional diagnostic output, run the documented debug mode:

DEBUG=1 docker compose run --rm openvpn

Use the resulting messages to identify whether the failure is an image, permission, configuration or key-material problem. Do not discard the persistent directory until you know which data is damaged.

Clients time out

  • Verify the VPS has the public address or DNS name used in ovpn_genconfig.
  • Confirm UDP 1194 is open in the provider firewall and the operating-system firewall.
  • Run docker compose ps and inspect docker compose logs -f openvpn while attempting a connection.
  • Check that the Compose port mapping says 1194:1194/udp, not TCP.
  • Make sure the exported profile is from this server and has not been truncated or edited by a mail or messaging client.

The profile imports but authentication fails

Confirm that the client name was created successfully, that the profile was exported after certificate creation, and that the correct client-key passphrase is being entered. Re-export the profile for that client rather than manually copying certificate blocks between files. If the CA passphrase is being requested during certificate issuance, it is the CA passphrase—not the client-key passphrase.

A certificate or key is missing

Because the profile is generated from the files under /etc/openvpn, a missing or replaced persistent volume can make previously issued material unavailable. Stop and inspect the host directory and Compose volume mapping. Restore a known-good encrypted backup if necessary; do not initialize a new PKI over the old directory unless you accept that all existing profiles will need replacement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Operational and security checklist

  • Pin and record the image tag instead of relying on an unqualified latest tag.
  • Keep the CA passphrase and client-key passphrases in a secure password manager.
  • Use one client certificate per device or user.
  • Protect the persistent directory and encrypted backups with least-privilege access.
  • Allow only the required UDP port at the network edge and keep SSH access separately controlled.
  • Review logs during initial deployment and after upgrades.
  • Verify the project’s current documentation and image availability before changing versions; no 2026 update status is established here.

Command reference

Task Command When to run it
Generate server configuration docker compose run --rm openvpn ovpn_genconfig -u udp://YOUR_SERVER_OR_DOMAIN Once, before PKI initialization
Initialize the CA docker compose run --rm openvpn ovpn_initpki Once for a new persistent data directory
Start the service docker compose up -d openvpn After configuration and whenever the service is stopped
Follow logs docker compose logs -f openvpn Startup and connection troubleshooting
Issue a client certificate docker compose run --rm openvpn easyrsa build-client-full CLIENTNAME Once per client
Export a profile docker compose run --rm openvpn ovpn_getclient CLIENTNAME > CLIENTNAME.ovpn After issuing each client certificate
Enable debug output DEBUG=1 docker compose run --rm openvpn When normal logs do not explain a startup problem

What success looks like

A completed deployment has a running OpenVPN container, a persistent /etc/openvpn mount, UDP 1194 reachable on the VPS, a protected CA passphrase, and a separate exported .ovpn file for every authorized client. Keeping those pieces separate—server generation, CA initialization, service startup, certificate issuance and profile export—makes the setup repeatable and makes failures easier to diagnose.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.