Docker Compose is the recommended way to run PiVPN Web in production. It keeps your configuration in a single versioned file, handles container lifecycle management, and makes it easy to update or reconfigure the service without having to remember longDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/AZhur771/pivpn-web/llms.txt
Use this file to discover all available pages before exploring further.
docker run flags.
The docker-compose.yml file
The following is thedocker-compose.yml shipped with PiVPN Web. It defines a single service that exposes the web UI on port 51821 and restarts automatically unless you explicitly stop it.
Field reference
| Field | Description |
|---|---|
image | The published Docker Hub image (andrew771/pivpn-web). Pin to a semver tag (e.g. andrew771/pivpn-web:1.1.2) for stability. |
container_name | Names the running container pivpn-web so you can reference it in docker commands without looking up the container ID. |
ports | Maps host port 51821 to container port 51821. The application listens internally on the port defined by the PORT environment variable (default 3001), but the published image defaults PORT to 51821. Change the left-hand value to expose the UI on a different host port. |
restart: unless-stopped | Docker automatically restarts the container on daemon restarts and after crashes. It will not start the container if you stopped it manually with docker compose stop. |
environment | Passes environment variables into the container at runtime. All PiVPN Web configuration is done through environment variables. |
Adding required environment variables
Expand theenvironment block to include all credentials needed for SSH access and dashboard authentication:
| Variable | Required | Description |
|---|---|---|
SSH_HOST | Yes | IP address or hostname of the machine running PiVPN. |
SSH_PORT | No (default 22) | SSH port on the PiVPN host. |
SSH_USER | Yes | SSH username used to connect to the PiVPN host. |
SSH_PASSWORD | Yes | SSH password for the above user. |
ADMIN_USER | Yes | Username for the PiVPN Web admin account. |
ADMIN_PASSWORD | Yes | Password for the PiVPN Web admin account. |
Starting the service
Create the compose file
Save the
docker-compose.yml content above to a directory on your Docker host, for example ~/pivpn-web/docker-compose.yml.Start the service
From the directory containing your Docker will pull the image if it is not already present and start the container in the background. The dashboard will be available at
docker-compose.yml, run:http://<your-host>:51821.View logs
Stream live logs from the running container:Press
Ctrl+C to stop following. Omit -f to print existing logs and exit.Using a .env file for secrets management
Instead of embedding credentials directly indocker-compose.yml, you can store them in a .env file in the same directory. Docker Compose automatically loads this file and substitutes the values.
.env
docker-compose.yml (referencing the variables)