如何在Docker中运行v2ray
安装Docker
安装依赖
1 |
apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common |
安装Key
1 |
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add - |
添加源
1 |
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable" |
安装docker-ce
1 2 |
apt-get update apt-get install docker-ce docker-ce-cli containerd.io |
测试
1 |
docker run hello-world |
输出
1 2 |
Hello from Docker! This message shows that your installation appears to be working correctly. |
安装docker-composer
1 2 |
curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose |
测试
1 |
docker-compose --version |
输出
1 |
docker-compose version 1.26.2, build eefe0d31 |
运行v2ray
这里使用的是官方的v2fly:https://hub.docker.com/r/v2fly/v2fly-core,https://github.com/v2fly/docker
1 |
docker run --network host --name tcp -v /etc/v2ray:/etc/v2ray --restart=always -d v2fly/v2fly-core |
TLS证书需要放在/etc/v2ray目录下,从/etc/letsencrypt/archive里找到需要的证书文件
相应的配置文件部分需要修改
1 2 3 4 |
"certificates": [{ "certificateFile": "/etc/v2ray/fullchain.pem", "keyFile": "/etc/v2ray/privkey.pem" }] |
There are no comments yet