V2ray-core: docker alpine 下运行失败

Created on 13 Oct 2016  ·  9Comments  ·  Source: v2ray/v2ray-core

1) 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明)
1) What version of V2Ray are you using?
V2Ray 版本 : v2.2.1

2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。
2) What your scenario of using V2Ray? E.g., Watching YouTube videos in Chrome via Socks/VMess proxy.
正在搭建....

3) 你看到的不正常的现象是什么?
3) What did you see?
docker alpine 系统下 执行 v2ray 出现 bash: ./v2ray: No such file or directory 错误,任何参数 都会报

4) 你期待看到的正确表现是怎样的?
4) What do you expected to see instead?
-version or -config 能运行

5) 请附上你的配置文件。
5) Please attach your configuration file.

Most helpful comment

Alphine缺省不安装glibc,使用了musl libc替代,通常的程序都是链接glibc的,导致无法运行。
可以在Dockerfile中添加
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
musl与glibc兼容,试了下的确可以运行,我没测试具体功能。

http://stackoverflow.com/questions/34729748/installed-go-binary-not-found-in-path-on-alpine-linux-docker

All 9 comments

不太清楚你的 docker 环境是如何配置的,通常 V2Ray 会被安装在 /usr/bin/v2ray/v2ray,你需要运行如下命令:

/usr/bin/v2ray/v2ray -version

@v2ray

以下为 Dockerfile

FROM alpine:3.4

MAINTAINER mritd <[email protected]>

ENV TZ 'Asia/Shanghai'

ENV VERSION 2.2.1

WORKDIR /root

RUN apk upgrade --update && \
    apk add --update bash tzdata wget && \
    wget --no-check-certificate https://github.com/v2ray/v2ray-core/releases/download/v$VERSION/v2ray-linux-64.zip && \
    unzip v2ray-linux-64.zip && \
    ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
    echo "Asia/Shanghai" > /etc/timezone && \
    rm -f v2ray-linux-64.zip && \
    rm -rf /var/cache/apk/*

CMD ["/bin/bash"]

经可测 无论那种安装方式,在 alpine 系统下二进制文件都无法运行,对 golang 不太了解,感觉像是 代码里调用了 bash 相关的 东西或者 bash 脚本,在 apline 这种精简系统下可能出现某些问题

@v2ray CMD 写的 bash 是因为我发现直接运行不了 v2ray,然后进去手动运行 调试的

看上去 Alphine 需要一些特殊的编译方式:

https://www.reddit.com/r/golang/comments/4cxrcv/whats_the_proper_way_to_build_golang_apps_for/

具体细节不太清楚。

Alphine缺省不安装glibc,使用了musl libc替代,通常的程序都是链接glibc的,导致无法运行。
可以在Dockerfile中添加
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
musl与glibc兼容,试了下的确可以运行,我没测试具体功能。

http://stackoverflow.com/questions/34729748/installed-go-binary-not-found-in-path-on-alpine-linux-docker

@seanzxx 好的 谢谢,撸了一个 image,还没测试 https://hub.docker.com/r/mritd/v2ray/

最新的 V2Ray release 已经修复了这个问题,可以直接在 Alpine Linux 上运行,不再需要上述的补丁了。

好的感谢

@seanzxx ,确实是这个问题~

Was this page helpful?
0 / 5 - 0 ratings