Docker deployment
These examples use Linux host networking and local images built from the same source revision. Build the images · Release and build guide
Server
Create a dedicated empty MySQL database and a user that can create tables, read, and write. Prepare cert/ and a writable backups/, then install the PKI and set the permissions shown in the Compose guide. In the server directory, substitute your gateway address, MySQL URL, and initial administrator password. Prepare the server directories
export TUNNEL_HOST=api.tunnel.example.com
export TUNNEL_DATABASE_URL='mysql://tunnel:DB_PASSWORD@127.0.0.1:3306/tunnel'
export TUNNEL_INIT_ADMIN_PASSWORD='replace-with-a-strong-password'
docker run -d --restart always --name tunnel-server --network host \
--cap-drop ALL --security-opt no-new-privileges:true \
-e TUNNEL_HOST -e TUNNEL_DATABASE_URL -e TUNNEL_INIT_ADMIN_PASSWORD \
-e TUNNEL_MANAGED_PKI_SEED=/app/cert \
-v "$PWD/cert:/app/cert:ro" -v "$PWD/backups:/app/backups" \
tunnel-server:main
docker logs --tail 100 tunnel-serverOpen http://SERVER_ADDRESS:9650/ and sign in as admin. Default listeners
For SQLite, add -e TUNNEL_DATABASE=sqlite and -v "$PWD/data:/app/data", and remove -e TUNNEL_DATABASE_URL. Give UID/GID 10001:10001 ownership of the writable data/ directory. For PostgreSQL, add -e TUNNEL_DATABASE=postgres and supply its connection URL. Database and directory settings
Client
Add a direct client in the console, copy its registration key, and download the certificate ZIP. Prepare cert/ and a writable data/. Install the certificates and set permissions as shown in the Compose guide. Run these commands in the client directory with your control and enrollment endpoints and registration key. Prepare the client directories
export TUNNEL_CLIENT_ENDPOINT=tls://api.tunnel.example.com:9651
export TUNNEL_CLIENT_WEB_ENDPOINT=https://api.tunnel.example.com:9650
export TUNNEL_CLIENT_KEY='client-key-from-console'
docker run -d --restart always --name tunnel-client --network host \
--cap-drop ALL --security-opt no-new-privileges:true \
-e TUNNEL_CLIENT_ENDPOINT -e TUNNEL_CLIENT_WEB_ENDPOINT -e TUNNEL_CLIENT_KEY \
-v "$PWD/cert:/app/cert:ro" -v "$PWD/data:/app/data" \
tunnel-client:main
docker exec tunnel-client /app/xtc status --config /app/app.ymlFor root-based enrollment, put the trusted public root.pem into cert/ and add -e TUNNEL_CLIENT_ROOT=/app/cert/root.pem. Client identity settings
For MQTT, extract the complete certificate ZIP into mqtt-client/ and replace the cert/ mount with -v "$PWD/mqtt-client:/app/mqtt-client:ro". Set -e TUNNEL_CLIENT_CONFIG=/app/mqtt-client/app.yml, remove the three direct-access variables, and retain the data mount. Point --config to the MQTT bundle’s app.yml when checking status. MQTT access
Optional settings
To keep file logs across container recreations, create logs/ owned by 10001:10001 and add -v "$PWD/logs:/app/logs". For Nginx on the same host, add -v "$PWD/run:/run/xigexb-tunnel" to the server and set permissions on the shared directory as shown in the proxy guide. Data and log paths · HTTPS reverse proxy