AdGuard VPN CLI within a Docker container
Report Bug
·
Request Feature
This project allows you to use AdguardVPN-CLI within a Docker container. It provides a simple and efficient way to manage AdguardVPN through the command line in a containerized environment.
Important
Authentication Change Notice: As of version 1.5.10, AdGuard VPN CLI has transitioned from username/password authentication to web-based authentication. The old ADGUARD_USERNAME and ADGUARD_PASSWORD environment variables are no longer used for authentication, but are kept for backward compatibility in configuration.
Before proceeding, please review the following content and create your .env file accordingly. You can refer to the .env.sample file provided in this repository for guidance.
Important
New Authentication Process: AdGuard VPN CLI now uses web-based authentication instead of username/password. You need to perform an initial authentication using the web flow before the VPN can connect.
-
First-time Setup:
- Start the main container:
docker-compose up -d - Check the logs to find the authentication link:
docker logs adguard-vpn-cli - When running adguardvpn-cli for the first time, check the docker logs for the authentication link. Once you access the link and complete the authentication, you won't need to authenticate again for subsequent runs. The link format looks like
https://auth.adguard.io/device_code?user_code=xxxx. - Note: If you have authenticated via the web browser, please wait a moment for the process to continue automatically. It is not frozen.
- Warning: If Two-Factor Authentication (2FA) is enabled on your account, you may experience issues with this login process.
- Start the main container:
-
Volume Mount: The container now mounts
./datadirectory to persist authentication credentials across container restarts.
AdguardVPN-CLI + qBittorrent
version: "3"
services:
adguard-vpn-cli:
image: supersunho/adguardvpn-cli:latest
restart: unless-stopped
container_name: adguard-vpn-cli
env_file: .env
volumes:
- ./data:/root/.local/share/adguardvpn-cli
healthcheck:
test: ping -c 1 www.google.com || exit 1
interval: 1m
timeout: 10s
retries: 1
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun
ports:
- 6089:6089
- 6881:6881
- 6881:6881/udp
qbittorrent:
image: linuxserver/qbittorrent:latest
container_name: qbittorrent
environment:
- PUID=0
- PGID=0
- TZ=Asia/Seoul
volumes:
- ./config:/config
- ./downloads:/downloads
devices:
- /dev/fuse:/dev/fuse:rwm
cap_add:
- SYS_ADMIN
depends_on:
- adguard-vpn-cli
network_mode: service:adguard-vpn-cli| Variable | Description | Default value | Allow values |
|---|---|---|---|
| ADGUARD_USERNAME | Username for login | "username" | |
| ADGUARD_PASSWORD | Password for login | "password" | |
| ADGUARD_CONNECTION_LOCATION | Defaults to the last used location | "JP" | |
| ADGUARD_CONNECTION_TYPE | Set VPN operating mode | "TUN" | TUN / SOCKS |
| ADGUARD_SOCKS5_USERNAME | Set the SOCKS username | "username" | |
| ADGUARD_SOCKS5_PASSWORD | Set the SOCKS password | "password" | |
| ADGUARD_SOCKS5_HOST | Set the SOCKS listen host. | "127.0.0.1" | |
| ADGUARD_SOCKS5_PORT | Set the SOCKS port | 1080 | |
| ADGUARD_SEND_REPORTS | Send crash reports to developers | false | true / false |
| ADGUARD_SET_SYSTEM_DNS | Set the system DNS servers | false | true / false |
| ADGUARD_USE_CUSTOM_DNS | Use the custom DNS servers | true | true / false |
| ADGUARD_CUSTOM_DNS | Set the DNS upstream server | "1.1.1.1" | |
| ADGUARD_USE_KILL_SWITCH | Use the Kill Switch | true | true / false |
| ADGUARD_USE_KILL_SWITCH_CHECK_INTERVAL | Check interval for Kill Switch | 30 | |
| ADGUARD_UPDATE_CHANNEL | Set update channel | "release" | release / beta / nightly |
| ADGUARD_SHOW_HINTS | Show hints after command execution | "on" | on / off |
| ADGUARD_DEBUG_LOGGING | Set debug logging | "on" | on / off |
| ADGUARD_SHOW_NOTIFICATIONS | Get notified about the status of the VPN connection | "on" | on / off |
| ADGUARD_PROTOCOL | Set the protocol used by AdGuard VPN | "auto" | auto / http2 / quic |
| ADGUARD_POST_QUANTUM | Set whether to use advanced cryptographic algorithms resistant to quantum computer attacks to protect your traffic from potential future threats | "off" | on / off |
| ADGUARD_TELEMETRY | Set whether to send anonymized usage data to developers | false | true / false |
| ADGUARD_TUN_ROUTING_MODE | Set VPN tunnel routing mode | "AUTO" | AUTO / SCRIPT / NONE |
| ADGUARD_BOUND_IF_OVERRIDE | Override network interface to use for outbound VPN traffic (pass "" to disable) | "" | interface name or "" |
| ✨ADGUARD_MAX_LEAK_TOLERANCE | Termination on first leak (0 = immediate termination on first leak) | 0 | |
| ✨ADGUARD_LEAK_WARNING_ONLY | When a leak, only an warning (true = warning only, false = terminate) | false | true / false |
| ✨ADGUARD_MAX_IP_DETECTION_RETRIES | Maximum number of IP detection attempts | 3 | number |
| ✨ADGUARD_IP_DETECTION_RETRY_DELAY | IP detection retry delay Seconds | 10 | number |
Important
ADGUARD_SOCKS5_HOST: For non-localhost addresses, you need to protect the proxy with a username and password.ADGUARD_USE_KILL_SWITCH_CHECK_INTERVAL: A very short check interval is not recommended.- Authentication Variables:
ADGUARD_USERNAMEandADGUARD_PASSWORDare no longer used for authentication as of version 1.5.10. Authentication is now done via web-based flow. These variables are kept for backward compatibility in other configuration aspects.
Please check the location and add the city, country or ISO code to ADGUARD_CONNECTION_LOCATION
| ISO | Country | City |
|---|---|---|
| AE | UAE | Dubai |
| AR | Argentina | Buenos Aires |
| AT | Austria | Vienna |
| AU | Australia | Sydney |
| BE | Belgium | Brussels |
| BG | Bulgaria | Sofia |
| BR | Brazil | São Paulo |
| CA | Canada | Vancouver |
| CA | Canada | Montreal |
| CA | Canada | Toronto |
| CH | Switzerland | Zurich |
| CL | Chile | Santiago |
| CN | China | Shanghai |
| CO | Colombia | Bogota |
| CY | Cyprus | Nicosia |
| CZ | Czechia | Prague |
| DE | Germany | Berlin |
| DE | Germany | Frankfurt |
| DK | Denmark | Copenhagen |
| EE | Estonia | Tallinn |
| EG | Egypt | Cairo |
| ES | Spain | Barcelona |
| ES | Spain | Madrid |
| FI | Finland | Helsinki |
| FR | France | Paris |
| FR | France | Marseille |
| GB | United Kingdom | Manchester |
| GB | United Kingdom | London |
| GR | Greece | Athens |
| HK | Hong Kong | Hong Kong |
| HR | Croatia | Zagreb |
| HU | Hungary | Budapest |
| ID | Indonesia | Jakarta |
| IE | Ireland | Dublin |
| IL | Israel | Tel Aviv |
| IN | India | Mumbai |
| IR | Iran | Tehran |
| IS | Iceland | Reykjavik |
| IT | Italy | Rome |
| IT | Italy | Milan |
| IT | Italy | Palermo |
| JP | Japan | Tokyo |
| KH | Cambodia | Phnom Penh |
| KR | South Korea | Seoul |
| KZ | Kazakhstan | Astana |
| LT | Lithuania | Vilnius |
| LU | Luxembourg | Luxembourg |
| LV | Latvia | Riga |
| MD | Moldova | Chișinău |
| MX | Mexico | Mexico City |
| NG | Nigeria | Lagos |
| NL | Netherlands | Amsterdam |
| NO | Norway | Oslo |
| NP | Nepal | Kathmandu |
| NZ | New Zealand | Auckland |
| PE | Peru | Lima |
| PH | Philippines | Manila |
| PL | Poland | Warsaw |
| PT | Portugal | Lisbon |
| RO | Romania | Bucharest |
| RS | Serbia | Belgrade |
| RU | Russia | Moscow |
| SE | Sweden | Stockholm |
| SG | Singapore | Singapore |
| SK | Slovakia | Bratislava |
| TH | Thailand | Bangkok |
| TR | Turkey | Istanbul |
| TW | Taiwan | Taipei |
| UA | Ukraine | Kyiv |
| US | United States | Seattle |
| US | United States | Silicon Valley |
| US | United States | Phoenix |
| US | United States | Las Vegas |
| US | United States | Denver |
| US | United States | Dallas |
| US | United States | Los Angeles |
| US | United States | Atlanta |
| US | United States | New York |
| US | United States | Miami |
| US | United States | Boston |
| US | United States | Chicago |
| VN | Vietnam | Hanoi |
| ZA | South Africa | Johannesburg |