v2fly / docker Goto Github PK
View Code? Open in Web Editor NEWdocker build repo for v2fly
Home Page: https://hub.docker.com/r/v2fly/v2fly-core
License: MIT License
docker build repo for v2fly
Home Page: https://hub.docker.com/r/v2fly/v2fly-core
License: MIT License
@kslr Github这边已经更新了,但是Docker Hub上还是v4.24.2,能麻烦开发者抽空更新下吗? 谢谢!
v2fly v5 support
使用docker run可以运行,但compose可以修改端口等配置信息,很方便,所以还是想用compose,但是报错。
# docker run -d --name v2ray -v $PWD/config.json:/etc/v2fly/config.json -v $PWD/ca:/etc/v2fly/ca -p 443:443 v2fly/v2fly-core run -c /etc/v2fly/config.json
# docker-compose.yaml
version: '3.9'
services:
v2ray:
image: v2fly/v2fly-core
container_name: v2ray
restart: unless-stopped
ports:
- '443:443'
volumes:
- $PWD/config.json:/etc/v2fly/config.json
- $PWD/ca:/etc/v2fly/ca/
- $PWD/logs:/etc/v2fly/logs/
command:
- /usr/bin/v2ray run -c /etc/v2fly/config.json
{
"log": {
"loglevel": "error",
"access": "/etc/v2fly/logs/access.log",
"error": "/etc/v2fly/logs/error.log"
},
"inbounds": [
{
"port": 443,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "xxxxxxxxxxxx",
"level": 0,
"alterId": 0,
"email": "[email protected]"
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"certificates": [
{
"certificateFile": "/etc/v2fly/ca/server.cer",
"keyFile": "/etc/v2fly/ca/server.key"
}
]
}
}
}
],
"outbounds": [
{
"protocol": "freedom"
}
]
}
container 不能正常启动。
docker logs 报错信息:
v2ray /usr/bin/v2ray run -c /etc/v2fly/config.json: unknown command
Run 'v2ray help /usr/bin/v2ray run -c' for usage.
尝试过修改command,v2ray help都不能正常打印。
目前创建的命令是这样
docker run --name v2ray -v /etc/v2ray/config.json:/etc/v2ray/config.json:ro v2fly/v2fly-core
日志返回是
020-09-28T16:37:36.708822233Z V2Ray v4.29.0 (v2fly/155c0e07) dockerfly-amd64 (go1.15.2 linux/amd64)
2020-09-28T16:37:36.708852121Z A unified platform for anti-censorship.
2020-09-28T16:37:36.818175991Z 2020/09/28 16:37:36 [Info] v2ray.com/core/common/platform/ctlcmd:
2020-09-28T16:37:36.818204735Z v2ctl> Read config: /etc/v2ray/config.json
2020-09-28T16:37:36.905166281Z 2020/09/28 16:37:36 [Warning] v2ray.com/core: V2Ray v4.29.0 started
就...没太看出来哪有问题。这个docker接入有具体的教程么orz果然是用docker搭的人太少了吗
Can someone send me base config which I will modify and link to etc/v2ray/config
It can be vmess or vless and incomming connection will be from '80' port
config.json 我抄
https://github.com/v2fly/v2ray-examples/blob/master/VLESS-TCP-TLS%20(maximal%20by%20rprx)/config_client.json
替换了下面该替换的地方
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"port": 10800,
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
"udp": true
}
}
],
"outbounds": [
{
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "example.com", // 换成你的域名或服务器 IP(发起请求时无需解析域名了)
"port": 443,
"users": [
{
"id": "", // 填写你的 UUID
"encryption": "none",
"level": 0
}
]
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"serverName": "example.com" // 换成你的域名
}
}
}
]
}
然后
docker run -d --name v2ray --network host -v /etc/v2ray/config.json:/etc/v2ray/config.json v2fly/v2fly-core
不知道为什么不行
配置是这个:
{
"log": {
"loglevel": "warning"
},
"inbound": {
"port": 1080,
"protocol": "socks",
"settings": {
"auth": "noauth"
}
},
"outbound": {
"protocol": "vmess",
"settings": {
"vnext": [
...
]
},
"streamSettings": {
"network": "ws",
"security": "none",
"wsSettings": {
"path": "/v1"
}
}
}
}
这个配置是按照网上的教程弄的,不是很理解这些配置的含义,docker run
之后,带宽流量蹭蹭蹭多了1M
多,请问这个正常吗
I hope Docker provides transparent proxy to support iptables or nftables by default
操作如下:
$ git clone https://github.com/v2fly/docker.git
$ cd v2fly
$ sudo docker build -t v2fly .
但失败了, 请问应该如何构建这个 docker? 谢谢.
logs:
$ sudo docker build -t v2fly .
[+] Building 2.2s (8/8) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 638B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/alpine:latest 0.3s
=> [1/4] FROM docker.io/library/alpine:latest@sha256:51b67269f354137895d43f3b3d810bfacd3945438e94dc5ac55fdac3403 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 30B 0.0s
=> CACHED [2/4] WORKDIR /tmp 0.0s
=> CACHED [3/4] COPY v2ray.sh /v2ray.sh 0.0s
=> ERROR [4/4] RUN set -ex && apk add --no-cache ca-certificates && mkdir -p /etc/v2ray /usr/local/share 1.8s
------
> [4/4] RUN set -ex && apk add --no-cache ca-certificates && mkdir -p /etc/v2ray /usr/local/share/v2ray /var/log/v2ray && ln -sf /dev/stdout /var/log/v2ray/access.log && ln -sf /dev/stderr /var/log/v2ray/error.log && chmod +x "${WORKDIR}"/v2ray.sh && "${WORKDIR}"/v2ray.sh "linux/amd64" "${TAG}":
0.319 + apk add --no-cache ca-certificates
0.323 fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz
0.618 fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/community/x86_64/APKINDEX.tar.gz
0.846 (1/1) Installing ca-certificates (20230506-r0)
0.878 Executing busybox-1.36.1-r15.trigger
0.882 Executing ca-certificates-20230506-r0.trigger
0.912 OK: 8 MiB in 16 packages
0.964 + mkdir -p /etc/v2ray /usr/local/share/v2ray /var/log/v2ray
0.965 + ln -sf /dev/stdout /var/log/v2ray/access.log
0.966 + ln -sf /dev/stderr /var/log/v2ray/error.log
0.966 + chmod +x /v2ray.sh
0.967 + /v2ray.sh linux/amd64
0.967 Downloading binary file: v2ray-linux-64.zip
0.967 Downloading binary file: v2ray-linux-64.zip.dgst
1.691 Error: Failed to download binary file: v2ray-linux-64.zip v2ray-linux-64.zip.dgst
------
Dockerfile:9
--------------------
8 |
9 | >>> RUN set -ex \
10 | >>> && apk add --no-cache ca-certificates \
11 | >>> && mkdir -p /etc/v2ray /usr/local/share/v2ray /var/log/v2ray \
12 | >>> # forward request and error logs to docker log collector
13 | >>> && ln -sf /dev/stdout /var/log/v2ray/access.log \
14 | >>> && ln -sf /dev/stderr /var/log/v2ray/error.log \
15 | >>> && chmod +x "${WORKDIR}"/v2ray.sh \
16 | >>> && "${WORKDIR}"/v2ray.sh "${TARGETPLATFORM}" "${TAG}"
17 |
--------------------
ERROR: failed to solve: process "/bin/sh -c set -ex && apk add --no-cache ca-certificates && mkdir -p /etc/v2ray /usr/local/share/v2ray /var/log/v2ray && ln -sf /dev/stdout /var/log/v2ray/access.log && ln -sf /dev/stderr /var/log/v2ray/error.log && chmod +x \"${WORKDIR}\"/v2ray.sh && \"${WORKDIR}\"/v2ray.sh \"${TARGETPLATFORM}\" \"${TAG}\"" did not complete successfully: exit code: 1
昨晚更新的latest是4.28.2...看到昨天4.29.0已经出来了,希望作者能更新,非常期待试试xtls,谢谢!
Latest version in Dockerhub is still 4.37.3, which is outdated.
Any plan to update them?
我是当客户端代理的。
我用的启动命令
sudo docker run -d --name v2ray -v ./config.json:/etc/v2fly/config.json -p 1080:1080 v2fly/v2fly-core run -c /etc/v2fly/config.json
config如下
{
"log": {
"access": "/app/logs/v2ray-access.log",
"error": "/app/logs/v2ray-error.log",
"loglevel": "info"
},
"inbounds": [
{
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
"udp": false,
"auth": "noauth"
},
"port": "1080"
},
{
"listen": "127.0.0.1",
"protocol": "http",
"settings": {
"timeout": 360
},
"port": "1087"
}
],
"outbounds": [
{
"mux": {
"enabled": false,
"concurrency": 8
},
"protocol": "vmess",
"streamSettings": {
"network": "tcp",
"tcpSettings": {
"header": {
"type": "none"
}
},
"security": "none"
},
"tag": "proxy",
"settings": {
"vnext": [
{
"address": "xx.xx.xx.xx",
"users": [
{
"id": "a559a39f-3943-44cb-9283-531a5e1d50ef",
"alterId": 0,
"level": 0,
"security": "aes-128-gcm"
}
],
"port": 49171
}
]
}
},
{
"tag": "direct",
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIP",
"userLevel": 0
}
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"response": {
"type": "none"
}
}
}
],
"dns": {},
"routing": {
"settings": {
"domainStrategy": "AsIs",
"rules": []
}
},
"transport": {}
}
sudo docker ps
如下
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a02a9c97485a v2fly/v2fly-core "/usr/bin/v2ray run …" 23 seconds ago Up 22 seconds 0.0.0.0:1080->1080/tcp, :::1080->1080/tcp v2ray
代码如下
package main
import (
"fmt"
"golang.org/x/net/proxy"
"io/ioutil"
"net/http"
)
func NewSocksDialer(addr string) (proxy.Dialer, error) {
return proxy.SOCKS5("tcp", addr, nil, proxy.Direct)
}
func main() {
dialer, err := NewSocksDialer("127.0.0.1:1080")
if err != nil {
fmt.Println(err.Error())
return
}
// create a socks5 dialer
// setup a http client
httpTransport := &http.Transport{Dial: dialer.Dial}
httpClient := &http.Client{Transport: httpTransport}
// set our socks5 as the dialer
if resp, err := httpClient.Get("https://www.google.com"); err != nil {
fmt.Println(err.Error())
return
} else {
defer resp.Body.Close()
if bs, err := ioutil.ReadAll(resp.Body); err == nil {
fmt.Println(string(bs))
} else {
fmt.Println(err.Error())
}
}
}
报错
Get "https://www.google.com": socks connect tcp 127.0.0.1:1080->www.google.com:443: read tcp 127.0.0.1:34442->127.0.0.1:1080: read: connection reset by peer
完全一样的配置,在宿主机直接起进程,就正常。
一周前安装了 Docker 版的 v2r server,观察到这样的现象:
一台国外主机,同时部署了 Docker 版本和普通安装版本,发现 Docker 版明显速度慢(我没有做定量的 benchmark,但是肉眼可见地变慢了)且不稳定(经常性刷不出来页面),切换到普通安装版本立马恢复正常。
二者使用了不同的端口和 id,应该不会发生冲突。
另外,使用多个城市的宽带和手机 4G 都发现了上述问题,因此大概率不是网络原因。
所以,请教一下是什么原因导致的?
还需要提供些什么 debug 信息,以便你们团队追查问题(如果真的是 Docker 版问题的话)?
我想在docker部署的v2fly-core中添加配置Environment="V2RAY_VMESS_AEAD_FORCED=false",但是找不到该文件
按照 #46 修改后还是返回该错误,docker run 启动时正常
proxy | v2ray run -c /etc/v2ray/config.json: unknown command
proxy | Run 'v2ray help run -c' for usage.
container_name: proxy
image: v2fly/v2fly-core:v5.1.0
volumes:
- $PWD/v2ray-config.json:/etc/v2ray/config.json
command:
- "run -c /etc/v2ray/config.json"
Hi,
Please allow the container to run as non root user. The current Dockerfile WORKDIR /root
prevents even --user
arg when running the container as non root. Changing it to WORKDIR /tmp
still builds the image successfully. Happy to submit a PR for that (and also remove dependency on openssl - for verifying the digest file, alpine image comes with sha512sum
).
Also, is there a particular reason that this container need to run as root? By default, to bind port > 1024, any process can do, and /dev/shm
is open for all for domain sockets. Even when the container needs to bind at port 443 on host, it can still be done via docker-proxy to redirect the port binding, and use high ports inside the container.
应该在代码中增加
mkdir -p /var/log/v2ray
RUN apk update && apk add ca-certificates && \
mkdir -p /usr/bin/v2ray && \
mkdir -p /var/log/v2ray && \
tar xvfz /tmp/v2ray.tgz -C /usr/bin/v2ray
outbound为socks 时,一直报错“unexpected server version: 72"
When can we update to 4.32.1?
It is now 4.22.1 , so vless is not for use.
每次docker-compose up -d && docker-compose down会产生一个随机volume
version: '3.8'
services:
proxy:
image: v2fly/v2fly-core
volumes:
- ./config/client.json:/etc/v2ray/config.json:ro
ports:
- "127.0.0.1:10800:10800"
The current latest image of v2fly-core is with plenty of security vulnerabilities, on alpine 3.17.1, and v2ray 5.2.1.
upgrading to alpine 3.18 and v2ray 5.4.1 would clear up the vulnerabilities
As in this repo, it's just using the "latest" tag to build the image, pls help retrigger the build in some way to make the latest image up to date.
Thanks!
在nginx的Dockerfile里有如下两行
# forward request and error logs to docker log collector
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
它将日志文件连接到标准输出中,这样可以在使用docker logs时能够打印nginx的日志
v2ray有必要将日志连接到标准输出吗? 例如:
FROM --platform=${TARGETPLATFORM} alpine:latest
LABEL maintainer="V2Fly Community <[email protected]>"
WORKDIR /root
ARG TARGETPLATFORM
ARG TAG
COPY v2ray.sh /root/v2ray.sh
RUN set -ex \
&& apk add --no-cache tzdata openssl ca-certificates \
&& mkdir -p /etc/v2ray /usr/local/share/v2ray /var/log/v2ray \
&& chmod +x /root/v2ray.sh \
# forward request and error logs to docker log collector
&& ln -sf /dev/stdout /var/log/v2ray/access.log \
&& ln -sf /dev/stderr /var/log/v2ray/error.log \
&& /root/v2ray.sh "${TARGETPLATFORM}" "${TAG}"
ENTRYPOINT ["/usr/bin/v2ray"]
技术方案来源:
https://serverfault.com/questions/599103/make-a-docker-application-write-to-stdout
https://github.com/nginxinc/docker-nginx/blob/5ce65c3efd395ee2d82d32670f233140e92dba99/mainline/debian/Dockerfile
I get the following error message:
$ docker logs v2ray
V2Ray 4.22.1 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.13.5 linux/amd64)
A unified platform for anti-censorship.
main: failed to create server > v2ray.com/core/app/log: failed to initialize access logger > open /var/folders/bk/5d1vvhsn1h7fjv4_blhxvpgm0000gn/T/cenmrev.v2rayx.log/access.log: no such file or directory
the v2fly/v2ray-core has a new v4.23.4 release, so we need to build the docker image accordingly
@kslr 抱歉。。。我又来了。。。麻烦更新一下吧,感谢!
When using geoip in conf file, the following error is shown:
v2ray_1 | V2Ray v4.22.1-124-g13b309f1 (v4.22.1-124-g13b309f1) docker-fly-amd64 (go1.13.9 linux/amd64)
v2ray_1 | A unified platform for anti-censorship.
v2ray_1 | main: failed to read config files: [/etc/v2ray/config.json] > v2ray.com/core/main/json: failed to execute v2ctl to convert config file. > v2ray.com/core/common/platform/ctlcmd: failed to execute v2ctl:
v2ray_1 | v2ctl> Read config: /etc/v2ray/config.json
v2ray_1 | v2ray.com/core/infra/conf: invalid field rule > v2ray.com/core/infra/conf: failed to load GeoIP: private > proto: can't skip unknown wire type 7 > exit status 255
And when I change back to v4.22.1, everything works fine.
I've tried to add geoip into /usr/local by setting -v in the docker run command, but it doesn't work.
如题
Please update on Docker Hub https://github.com/v2fly/v2ray-core/releases/tag/v5.2.1
使用该issue中提出的启动命令:
docker run \
-d \
--cap-add=NET_ADMIN \
--restart=always \
--network host \
-e V2RAY_LOCATION_CONFIG=/etc/v2ray \
-e V2RAY_LOCATION_ASSET=/etc/v2ray \
-e V2RAY_BUF_READV=enable \
-v /etc/v2ray:/etc/v2ray \
-v /var/log/v2ray:/var/log \
--name v2ray \
v2fly/v2fly-core
启动后检查docker ps -a发现容器在无限重启,请问应如何修正
In readme file line:
docker run ..... -v /path/to/config.json:/etc/v2fly/config.json .....
bind config path is wrong. I check it inside container and
/etc/v2fly/config.json
should change to
/etc/v2ray/config.json
Pls update on Docker Hub
https://github.com/v2fly/v2ray-core/releases/tag/v4.45.0
日志中出现了一些 operation not permitted 的内容, 不知道 docker 里有没有CAP_NET_ADMIN这种能力? 该怎么解决呢
2020/07/06 17:21:51 [Info] [2754594387] v2ray.com/core/transport/internet: failed to apply socket options > v2ray.com/core/transport/internet: failed to set SO_MARK > operation not permitted
Docker Hub 严重托更了 🤣
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.