This project provides a V2Ray server inside a Docker container with traffic redirection to a specific domain (m.youtube.com
by default).
- Redirect all traffic through V2Ray to a predefined domain (
m.youtube.com
). - Dockerized for easy deployment and portability.
- Supports SOCKS5 proxy.
- Docker and Docker Compose installed on your server.
- A V2Ray client installed on your device (e.g., V2RayNG for Android, V2RayX for macOS, etc.).
v2ray-docker/
├── Dockerfile # Dockerfile to build the V2Ray image
├── config.json # V2Ray configuration file
├── docker-compose.yml # Docker Compose file for container orchestration
└── README.md # Instructions to run and connect
git clone https://github.com/yourusername/v2ray-docker.git
cd v2ray-docker
docker-compose build
docker-compose up -d
- The V2Ray server will start in a detached mode and run on port 1080 by default.
- You can check the logs to verify if the server is running:
docker logs v2ray-container
To stop the server:
docker-compose down
Download and install a V2Ray client on your device. Some popular options:
- V2RayNG for Android
- V2RayX for macOS
- V2RayN for Windows
-
Open the V2Ray client on your device.
-
Create a new server configuration using the following details:
- Server Address: The IP address of your Docker host (e.g.,
123.45.67.89
). - Port:
1080
(or the port you specified indocker-compose.yml
). - Protocol:
SOCKS5
- Username/Password: Leave these empty (no authentication).
- Server Address: The IP address of your Docker host (e.g.,
-
Save the configuration and start the proxy.
Once connected, try accessing any website. Your V2Ray setup will redirect the traffic to m.youtube.com
(or another domain if you've changed the config).
If you want to change the website that all traffic gets redirected to, edit the config.json
file:
"redirect": {
"host": "m.youtube.com" // Change this to your desired domain
}
After making changes, rebuild the Docker image and restart the server:
docker-compose build
docker-compose up -d
This project is licensed under the MIT License. See the LICENSE file for details.
docker build -t my-v2ray-image . docker run -d -p 1080:1080 --name my-v2ray-container my-v2ray-image