Run official Cloudflare WARP client in Docker.
To run the WARP client in Docker, just write the following content to docker-compose.yml
and run docker-compose up -d
.
version: '3'
services:
warp:
image: edwinhuish/warp
container_name: warp
restart: unless-stopped
ports:
- '1080:1080'
environment:
# - WARP_LICENSE_KEY= # optional
cap_add:
- NET_ADMIN
sysctls:
- net.ipv6.conf.all.disable_ipv6=0
- net.ipv4.conf.all.src_valid_mark=1
volumes:
- ./data:/var/lib/cloudflare-warp
# Restart container when it's unhealthy
autoheal:
image: willfarrell/autoheal
container_name: autoheal
restart: unless-stopped
environment:
- AUTOHEAL_CONTAINER_LABEL=all
volumes:
- /var/run/docker.sock:/var/run/docker.sock
Try it out to see if it works:
curl --socks5 127.0.0.1:1080 https://cloudflare.com/cdn-cgi/trace
If the output contains warp=on
or warp=plus
, the container is working properly. If the output contains warp=off
, it means that the container failed to connect to the WARP service.
You can configure the container through the following environment variables:
WARP_LICENSE_KEY
: The license key of the WARP client, which is optional. If you have subscribed to WARP+ service, you can fill in the key in this environment variable. If you have not subscribed to WARP+ service, you can ignore this environment variable.
Data persistence: Use the host volume ./data
to persist the data of the WARP client. You can change the location of this directory or use other types of volumes. If you modify the WARP_LICENSE_KEY
, please delete the ./data
directory so that the client can detect and register again.
The container uses GOST to provide proxy, where the environment variable GOST_ARGS
is used to pass parameters to GOST. The default is -L :1080
, that is, to listen on port 1080 in the container at the same time through HTTP and SOCKS5 protocols. If you want to have UDP support or use advanced features provided by other protocols, you can modify this parameter. For more information, refer to GOST documentation.
If you modify the port number, you may also need to modify the port mapping in the docker-compose.yml
.
The health check of the container will verify if the WARP client inside the container is working properly. If not, it will try to correct it.
If you want restart container when it's unhealthy, should use willfarrell/autoheal
Read in prev author blog post.