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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

You can run an OpenVPN server on a Linux VPS with Docker Compose by combining the kylemanna/openvpn image, the NET_ADMIN capability, UDP port 1194, and persistent storage for the OpenVPN PKI. The deployment has three separate one-time operations—generate the server configuration, initialize the certificate authority, and create each client certificate—followed by a normal background container.

This guide uses the current docker compose syntax, shows a bind-mounted configuration directory, and keeps the certificate authority and client keys persistent. Use a currently published, explicitly pinned image tag after checking the project’s documentation; the tag is intentionally not hard-coded here because image releases can change.

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

What this setup creates

The VPS runs one OpenVPN server process inside a container. Docker publishes the container’s UDP 1194 listener on the VPS, while NET_ADMIN gives the container the network-administration capability the image expects. The host directory ./openvpn-data/conf is mounted at /etc/openvpn, so the server configuration, certificate authority, certificates, keys and generated client profiles survive container recreation.

The initial setup is deliberately separate from normal startup:

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.
Phase Command family What it produces
Server configuration ovpn_genconfig OpenVPN server configuration based on the public address or DNS name
Public-key infrastructure ovpn_initpki Certificate authority and server certificates
Runtime docker compose up -d Running OpenVPN service
Client enrollment easyrsa build-client-full A certificate and private key for one named client
Profile export ovpn_getclient One portable .ovpn profile containing the client’s connection material

Do not treat the exported profile as a harmless text file. It contains private key material and should be delivered and stored like a password.

Prerequisites and decisions

VPS and network requirements

  • A Linux VPS with a publicly reachable IPv4 address or a DNS name that resolves to it.
  • Docker Engine and the Docker Compose plugin installed for the account that will run the commands.
  • Inbound UDP port 1194 allowed by both the VPS operating-system firewall and any provider-level security group or firewall.
  • Shell access with permission to run Docker commands and create files in the deployment directory.

The standard port in the project’s documented example is UDP 1194. You can choose a different external port, but then the published port, firewall rule and generated client configuration must agree. This walkthrough keeps the documented port to reduce moving parts.

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

Choose a persistent storage layout

The example below uses a bind mount, which makes backups and inspection straightforward:

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

Run every Compose command from this directory. If you instead use a named Docker volume, keep the same volume for every initialization, client-creation and export command; switching volumes midway makes the container appear to have lost its CA and certificates.

Pin the image

Replace PINNED_TAG in the compose file with a tag that is currently published by the project. An explicit tag makes upgrades deliberate and reproducible. Avoid silently tracking latest on a production VPN, and read the current project documentation before changing tags because image behavior and supported Compose syntax are volatile.

Create the Docker Compose service

Create docker-compose.yml (the filename is still accepted) or compose.yml in ~/openvpn-docker:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
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:

  • image: the OpenVPN image and the release tag you selected.
  • cap_add: NET_ADMIN: grants the container the network capability required by this setup.
  • ports: maps UDP 1194 on the VPS to UDP 1194 in the container. The /udp suffix matters; a TCP mapping is a different service.
  • volumes: persists everything under /etc/openvpn on the host.

Current Compose does not require a top-level version key. Older examples often show version: '2' and the hyphenated docker-compose command. Use the modern docker compose command shown here; do not mix command styles while troubleshooting.

Open the firewall before testing

Allow inbound UDP 1194 in the VPS firewall and, if applicable, in the hosting provider’s network firewall. Firewall tooling differs by Linux distribution, so use the method documented for your operating system. A rule that opens TCP 1194 does not permit this configuration. Keep the port restricted to UDP and verify that the VPS has a public route rather than only a private address.

Do not assume a successful container start proves reachability. The process can be healthy while an upstream security group silently drops packets. Test the network path only after the service is running and a client profile has been imported.

Generate the server configuration

From the directory containing the Compose file, run:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
docker compose run --rm openvpn ovpn_genconfig -u udp://YOUR_SERVER_OR_DOMAIN

Replace YOUR_SERVER_OR_DOMAIN with the public IP address or DNS name that clients will use. Include the udp:// scheme exactly as shown. This command writes the generated server configuration into the mounted /etc/openvpn directory. It does not start the long-running server, and it does not create client certificates.

Before proceeding, check that the value is externally reachable and stable. If you use a DNS name, make sure it resolves to the VPS from the networks where clients will connect. The generated endpoint is embedded in exported profiles, so an incorrect address requires regenerating or otherwise updating profiles rather than merely restarting the container.

Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

Initialize the certificate authority

Create the PKI with:

docker compose run --rm openvpn ovpn_initpki

The command asks you to create and confirm a CA passphrase. Use a strong, unique passphrase and store it in an offline password manager or another protected recovery location. The CA passphrase protects the authority that signs server and client certificates; you will need it for certificate-management operations, including issuing client certificates.

This passphrase is different from a client’s private-key passphrase. Never put either secret in the Compose file, shell history committed to a repository, ticket, or chat transcript. If the command reports that a PKI already exists, stop and verify that you are using the intended persistent directory before overwriting or reinitializing anything.

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

Start and verify the OpenVPN container

  1. Start the service in the background:
    docker compose up -d openvpn
  2. Follow its logs while it initializes:
    docker compose logs -f openvpn
  3. In a second shell, confirm the container is running:
    docker compose ps

Use Ctrl+C to leave the log view; it does not stop the background service. If the container is not listed as running, inspect the complete log output before creating client certificates. A profile generated from a failed or incomplete server initialization will not fix a startup problem.

Create a separate certificate for each client

Give every person or device its own certificate name. Descriptive names such as alice-laptop, phone-2026 or branch-router make later inventory and incident response easier. Do not share one profile among several users when individual revocation and auditing matter.

Issue a client certificate and key with Easy-RSA through the container:

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.
docker compose run --rm openvpn easyrsa build-client-full CLIENTNAME

Replace CLIENTNAME with the unique name you selected. The command prompts for the CA passphrase and, following the project’s recommended approach, asks you to protect the client private key with its own passphrase. The documentation advises against the nopass option because an unencrypted private key is easier to misuse if the profile file is copied.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

Repeat the command for each device, using a new name every time. Keep the CA passphrase available during issuance, but do not distribute it to clients. A client needs its own profile and private-key passphrase, not the CA secret.

Export the client .ovpn profile

After the certificate has been issued, export a self-contained profile:

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

Use the same CLIENTNAME supplied to build-client-full. The resulting file bundles the CA certificate, that client’s certificate and key, and the connection settings generated for your server. This is why a client can import one file instead of separately installing several certificate files.

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

Check that the file exists and has nonzero size before transferring it:

ls -l CLIENTNAME.ovpn

Send it through a secure, access-controlled channel. Do not publish it in a public repository, attach it to an unprotected support ticket, or leave it in a shared download directory. Delete temporary copies from shell hosts and desktops that do not need them, while retaining an encrypted administrative backup if your recovery policy requires one.

Import and test a client

Install an OpenVPN-compatible client on the target device, import the corresponding .ovpn file, and enter the client private-key passphrase when the client requests it. Client application labels differ by operating system, so follow the import workflow for the client you selected rather than changing the server’s generated profile.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

Test from a network outside the VPS itself, such as a home or cellular connection. A successful test should show the client as connected in its OpenVPN application and allow it to reach the resources your server configuration is intended to expose. If the connection never establishes, start with UDP reachability and the endpoint in the profile before changing certificates.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common failures

Symptom Likely check Action
The container exits immediately Configuration, image tag or capability error Read docker compose logs openvpn. For a verbose diagnostic run, set DEBUG=1 as documented by the project, for example DEBUG=1 docker compose run --rm openvpn ovpn_genconfig -u udp://YOUR_SERVER_OR_DOMAIN, then correct the reported error.
Client times out with no handshake UDP path or wrong endpoint Confirm the profile’s address, VPS firewall, provider firewall and the 1194:1194/udp mapping. A TCP rule will not help a UDP profile.
Initialization appears to have vanished Different working directory or volume Run commands from the directory containing the same Compose file and inspect the bind-mounted openvpn-data/conf directory. Do not create a second volume accidentally.
Certificate issuance asks for a CA passphrase you cannot provide CA secret unavailable Locate the protected recovery copy. Do not guess repeatedly or reinitialize the PKI on a live deployment; doing so creates a different authority and invalidates the relationship with existing certificates.
The exported file is missing or empty Wrong client name or failed issuance Verify that easyrsa build-client-full completed successfully for the exact same name, then rerun ovpn_getclient from the original deployment directory.

When a failure is ambiguous, capture the relevant logs and the exact command, but redact private keys, CA secrets and complete profile contents before sharing diagnostics.

Back up the deployment before upgrades

The bind-mounted openvpn-data/conf directory is the critical state. Back it up using an encrypted method that preserves file permissions and restricts access to administrators. Include the CA, server keys, client certificates and generated configuration; losing the CA prevents you from managing the same certificate hierarchy normally.

Record the image tag used in production and the date of each intentional change. Before upgrading, read the current kylemanna/docker-openvpn documentation and release information, test the new tag with a copy of the configuration, and keep the previous image tag available for rollback. Do not delete the persistent directory as part of an image update.

Operational security practices

  • Use a unique CA passphrase and protect it separately from the VPS.
  • Use a distinct client certificate and profile for every user or device.
  • Prefer passphrase-protected client keys; avoid nopass unless you have a documented compensating control.
  • Transfer profiles only over secure, authenticated channels and remove unneeded copies.
  • Limit administrative access to the VPS and protect Docker access, because Docker users can generally control the host.
  • Keep the image tag pinned, review changes before upgrading, and re-check the project’s current instructions because tags and syntax can change.
  • Plan how you will disable a lost or compromised client. The exact revocation workflow is version-sensitive; use the current project documentation rather than applying an unverified command to production.

Compose command reference

Purpose Command
Generate server configuration docker compose run --rm openvpn ovpn_genconfig -u udp://YOUR_SERVER_OR_DOMAIN
Initialize the CA and PKI docker compose run --rm openvpn ovpn_initpki
Start the service docker compose up -d openvpn
Follow logs docker compose logs -f openvpn
Issue a client certificate docker compose run --rm openvpn easyrsa build-client-full CLIENTNAME
Export a client profile docker compose run --rm openvpn ovpn_getclient CLIENTNAME > CLIENTNAME.ovpn

Pre-production checklist

  • The VPS has a public address or stable DNS name, and that value appears in the generated endpoint.
  • Docker and the Compose plugin run successfully for the deployment account.
  • UDP 1194 is allowed at every firewall layer.
  • The Compose service has NET_ADMIN, the UDP port mapping and persistent /etc/openvpn storage.
  • The CA passphrase is stored in a protected recovery location.
  • The container starts cleanly and its logs show no unresolved errors.
  • Each client has a unique certificate name, a passphrase-protected key and a securely delivered .ovpn file.
  • The image tag and configuration directory are recorded for repeatable upgrades and backups.

The Bottom Line

A reliable OpenVPN Docker Compose deployment depends less on a single startup command than on preserving the PKI, opening the correct UDP port, and keeping each client profile separate. Use the documented sequence—generate configuration, initialize the CA, start the service, issue individual certificates, and export profiles—then pin and periodically revalidate the image tag against the current project documentation.

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

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.