Categories: How To

๐Ÿš€ How to Install WireGuard with Docker on Ubuntu 24.04 (wg-easy Dashboard)

Introduction

WireGuard is a fast, lightweight, and modern VPN protocol designed for simplicity and performance.
If youโ€™re looking for a minimal yet powerful VPN solution, WireGuard with wg-easy is a great choice. It provides a clean web-based UI for managing peers โ€” perfect for self-hosted environments, small businesses, or labs.

In this post, Iโ€™ll guide you through deploying WireGuard using Docker on Ubuntu 24.04, based on my actual setup and test server configuration.


๐Ÿงฉ Prerequisites

Make sure you have the following ready:

  • A clean Ubuntu 24.04 server
  • Root or sudo access
  • Public IP address: 199.180.134.132 (replace with your own)
  • Docker installed

โš™๏ธ Step 1 โ€“ Install Docker

Weโ€™ll use Docker to simplify the deployment process.

curl -fsSL https://get.docker.com | sudo bash

Verify Docker installation:

docker --version

๐Ÿ“ Step 2 โ€“ Create a Volume for WireGuard Configuration

Create a directory to store all configuration files and keys:

sudo mkdir -p /srv/wireguard
sudo chmod -R 755 /srv/wireguard

๐Ÿ” Step 3 โ€“ Generate Admin Password Hash

Starting from wg-easy v14, plain text passwords are no longer supported.
You must use a bcrypt hash for the admin password.

To generate it:

docker run ghcr.io/wg-easy/wg-easy:14 wgpw YOUR_PASSWORD

Replace YOUR_PASSWORD with your desired dashboard password.
Example output:

$2a$12$Rc5VfU6n9d4Wm3JTnBYB1eUPEZvs4glH73VPYuKXGmuJsYkkKXJle

Keep this hash safe โ€” youโ€™ll use it in the next step.


๐Ÿณ Step 4 โ€“ Deploy the WireGuard Container

Now run the container using the command below.
Replace the IP and password hash with your own values.

docker run -d \
  --name=wg-easy \
  -e WG_HOST=199.180.134.132 \
  -e PASSWORD_HASH='$2a$12$Rc5VfU6n9d4Wm3JTnBYB1eUPEZvs4glH73VPYuKXGmuJsYkkKXJle' \
  -v /srv/wireguard:/etc/wireguard \
  -p 51820:51820/udp \
  -p 51821:51821/tcp \
  --cap-add=NET_ADMIN \
  --cap-add=SYS_MODULE \
  --sysctl="net.ipv4.conf.all.src_valid_mark=1" \
  --sysctl="net.ipv4.ip_forward=1" \
  --restart unless-stopped \
  ghcr.io/wg-easy/wg-easy:latest

๐Ÿ” Step 5 โ€“ Verify Container Status

Check if the container is running:

docker ps

You should see a container named wg-easy with a โ€œhealthyโ€ or โ€œupโ€ status.

To view logs:

docker logs wg-easy

๐ŸŒ Step 6 โ€“ Access the Management Dashboard

Once the container is running, open the web interface in your browser:

๐Ÿ‘‰ http://199.180.134.132:51821

Log in using the password you set earlier.

From here, you can:

  • Create new VPN peers
  • Download configuration files
  • View or delete existing peers
  • Scan QR codes for mobile setup

โš™๏ธ Step 7 โ€“ (Optional) Set Timezone

If you need to adjust timezone settings, you can add this variable to your Docker command:

-e TZ=Etc/UTC

โœ… Step 8 โ€“ Test the Connection

Download the client configuration from the dashboard and import it into your WireGuard client (available for Windows, macOS, Linux, Android, and iOS).
Activate the connection and test your IP at https://whatismyipaddress.com.

If it shows your VPN serverโ€™s IP, your setup is working perfectly!


๐Ÿงญ Conclusion

Youโ€™ve now deployed a fully functional WireGuard VPN server using Docker and wg-easy on Ubuntu 24.04.
With this setup, you can easily manage peers via a simple web UI โ€” no manual configuration files needed.

Highlights:

  • Secure VPN using WireGuard protocol
  • Simple Docker-based deployment
  • Web UI for easy management
  • Lightweight and production-ready
ferisetyawanmyid

Recent Posts

How To Install Certbot on Ubuntu 24.04: Set Up Letโ€™s Encrypt for Apache and Nginx

Securing your website with HTTPS is essential for privacy, SEO ranking, and user trust. Letโ€™s…

2 weeks ago

Best SSH Clients for Linux: Top Tools for Secure Remote Connections

If you manage Linux servers regularly, you know how important SSH (Secure Shell) is. Whether…

3 weeks ago

๐Ÿง Best Linux Distributions for Beginners and Daily Use (2025 Edition)

If youโ€™re new to Linux or thinking about switching from Windows or macOS, this guide…

4 weeks ago

Essential SRE Tools That Run on Linux

Introduction Site Reliability Engineering (SRE) has become a critical discipline in modern IT operations. The…

1 month ago

Best Free CRM Websites for Businesses in 2025

Updated: August 17, 2025 A practical guide to the best free CRM (Customer Relationship Management)…

2 months ago

Free Website Hosting Control Panel for Linux

If you run a VPS or dedicated server with Linux, you probably know that managing…

3 months ago

This website uses cookies.