# Wireguard VPN Docker Container This Docker container sets up a Wireguard VPN server, automatically generating a specified number of client configurations for easy VPN access. ## Features - **Wireguard VPN Server**: Utilizes the lightweight and secure Wireguard protocol for VPN services. - **Automatic Client Configuration**: Dynamically generates client configurations based on the specified number of clients. - **External IP Discovery**: Automatically detects and applies the server's external IP address in client configurations for remote access. - **Persistent Configuration**: Stores all configurations in a persistent Docker volume for easy management and backup. ## Configuration The setup is controlled through environment variables and volume mounts specified in `docker-compose.yml`. ### Environment Variables - `CLIENTS`: Specifies the number of client configurations to generate. Default is 1 if not set. ### Volume Mounts - `./config:/etc/wireguard`: Mounts the Wireguard configuration directory to persist server and client configurations outside the container. ## Usage 1. **Set the Number of Clients**: Edit `docker-compose.yml` to specify the number of client configurations needed by setting the `CLIENTS` environment variable. 2. **Build and Start the Container**: Run `docker-compose up --build`. This builds the Docker image if necessary, starts the Wireguard server, and generates client configurations. 3. **Access Client Configurations**: Client configurations are stored in the `./config` directory on the host, named `client1.conf`, `client2.conf`, etc., based on the number of clients specified. ## Note This container automatically handles IP forwarding and NAT setup for the VPN traffic. Ensure your host system allows UDP traffic on port 51820 for Wireguard to function correctly.