This guide explains how to deploy v2rayA + Docker + Docker Compose for managing v2ray proxies, offering a user-friendly web UI to manage and configure your v2ray server. This setup is ideal for users looking for an easy and efficient way to deploy v2ray servers with Docker, ensuring a scalable and maintainable environment using Docker Compose.
1. Preparation
1.1 Docker
Install Docker:
sudo pacman -S docker
Add your user to the Docker group:
sudo usermod -aG docker $(whoami)
Create Docker config directory:
sudo mkdir -p /etc/docker
Create /etc/docker/daemon.json to use a registry mirror:
cat <<EOF | sudo tee /etc/docker/daemon.json > /dev/null
{
"registry-mirrors": [
"https://dockerproxy.net"
]
}
EOF
Enable and start Docker:
sudo systemctl daemon-reload
sudo systemctl enable --now docker
Verify Docker:
docker ps
๐ก Tip : Adding your user to the Docker group avoids using
sudoevery time. ๐ก Tip : Use registry mirrors to speed up image downloads.
1.2 Docker Compose
Install Docker Compose:
sudo pacman -S docker-compose
Verify installation:
docker-compose --version
๐ก Tip : Docker Compose helps manage multi-container applications easily.
2. v2rayA
2.1 Prepare Directories
Create project directories:
mkdir -p software/v2raya/data
Create the Docker Compose file:
nvim software/v2raya/docker-compose.yml
2.2 Docker Compose Configuration
Example docker-compose.yml:
services:
v2raya:
image: mzz2017/v2raya:v2.2.5.8
restart: always
privileged: true
network_mode: host
container_name: v2raya
environment:
V2RAYA_LOG_FILE: /tmp/v2raya.log
V2RAYA_V2RAY_BIN: /usr/local/bin/xray
V2RAYA_NFTABLES_SUPPORT: off
IPTABLES_MODE: legacy
volumes:
- /lib/modules:/lib/modules:ro
- /etc/resolv.conf:/etc/resolv.conf
- $PWD/data:/etc/v2raya
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
2.3 Start the Container
cd software/v2raya
docker-compose up -d
Verify:
docker ps | grep v2raya
๐ก Tip : Ensure
$PWD/datapath matches your Docker Compose setup. ๐ก Tip : Usedocker logs v2rayato check container status if issues occur.
3. v2rayA Web UI Configuration
Access v2rayA Web UI:
- Open your browser and go to:
http://localhost:2017
3.1 Modify Settings
- Go to Settings โ GFWList
- Change from
offtoon (Proxy only GFWList)
๐ก Tip : This ensures only traffic to blocked sites is proxied.
3.2 Add a VLESS Node
To add a VLESS node corresponding to your v2ray server:
- Click Create โ VLESS
- Fill in the details from your v2ray server:
- Address: yourdomain.com
- Port: 443
- UUID:
your_uuid(generated in server setup) - Encryption: environment
- Transport: WebSocket
- WebSocket Path:
/ws/8f3a7b2c9d(as configured on server) - TLS: Enabled
- SNI / Host: yourdomain.com
- Save the node.
- Test the node inside v2rayA to ensure it connects successfully.
๐ก Tip : Use a randomized WebSocket path for security and stealth. ๐ก Tip : Always verify UUID and path match exactly with the server configuration.
3.3 Configure Browser Proxy (Firefox Example)
- HTTP Proxy:
127.0.0.1:20171 - SOCKS5 Proxy:
127.0.0.1:20170
๐ก Tip : Make sure the browser is using the correct proxy to route traffic through v2rayA.
4. Security and Optimization Tips
- Always use strong passwords and secure the Docker socket if exposing remotely.
- Keep Docker and v2rayA up to date:
sudo pacman -Syu
- Limit container privileges if not using
privileged: true. - Regularly back up your v2rayA
datadirectory.
5. Backup & Rollback
5.1 Backup Important Configurations
sudo mkdir -p /root/backup/v2raya
sudo cp -r software/v2raya/data /root/backup/v2raya/data.bak
5.2 Restore from Backup
sudo rm -rf software/v2raya/data
sudo cp -r /root/backup/v2raya/data.bak software/v2raya/data
docker-compose restart
๐ก Tip : Always stop containers before restoring backup. ๐ก Tip : Keep multiple backup versions for safety.
6. Troubleshooting
6.1 Container Not Starting
Check container logs:
docker logs v2raya
Common causes:
- Volume path errors.
- Docker network issues.
- Image not pulled correctly.
6.2 Docker Compose Issues
Check Docker Compose syntax:
docker-compose config
Fix errors and restart:
docker-compose down
docker-compose up -d
6.3 Web UI Connection Fails
- Ensure the container is running (
docker ps). - Verify
localhost:2017is accessible. - Confirm nodes are correctly configured in Web UI.
- Check browser proxy settings (HTTP: 20171, SOCKS5: 20170).
๐ก Tip : Use
docker logs v2rayato debug any connection issues in real time.