一、镜像
感谢teddysun 制作并提供v2ray的docker镜像
docker pull teddysun/v2ray
二、部署
2.1 创建v2ray文件夹
mkdir /etc/v2ray
2.2 创建config.json文件
vi /etc/v2ray/config.json
内容如下,可以复制粘贴
{
"log": {
"loglevel": "warning"
},
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"ip": [
"geoip:private"
],
"outboundTag": "block"
}
]
},
"inbounds": [
{
"listen": "0.0.0.0",
"port": 50250,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "xxxxxxxxxxxxxxx"
}
]
},
"streamSettings": {
"network": "tcp"
}
}
],
"outbounds": [
{
"protocol": "freedom",
"tag": "direct"
},
{
"protocol": "blackhole",
"tag": "block"
}
]
}
2.3 创建并启动v2ray 容器
docker run -d --network host --name v2ray --restart=always -v /etc/v2ray:/etc/v2ray teddysun/v2ray
说明:
建议使用host模式,因为只有host模式支持IPv4/IPv6双协议栈。使用Bridge桥接模式的话,只能支持IPv4.