Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker alpine 下运行失败 #272

Closed
mritd opened this issue Oct 13, 2016 · 11 comments
Closed

docker alpine 下运行失败 #272

mritd opened this issue Oct 13, 2016 · 11 comments

Comments

@mritd
Copy link

mritd commented Oct 13, 2016

  1. 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明)

  2. What version of V2Ray are you using?
    V2Ray 版本 : v2.2.1

  3. 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。

  4. What your scenario of using V2Ray? E.g., Watching YouTube videos in Chrome via Socks/VMess proxy.
    正在搭建....

  5. 你看到的不正常的现象是什么?

  6. What did you see?
    docker alpine 系统下 执行 v2ray 出现 bash: ./v2ray: No such file or directory 错误,任何参数 都会报

  7. 你期待看到的正确表现是怎样的?

  8. What do you expected to see instead?
    -version or -config 能运行

  9. 请附上你的配置文件。

  10. Please attach your configuration file.

@v2ray
Copy link
Collaborator

v2ray commented Oct 19, 2016

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

/usr/bin/v2ray/v2ray -version

@mritd
Copy link
Author

mritd commented Oct 19, 2016

@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 这种精简系统下可能出现某些问题

@mritd
Copy link
Author

mritd commented Oct 19, 2016

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

@v2ray
Copy link
Collaborator

v2ray commented Oct 19, 2016

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

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

具体细节不太清楚。

@seanzxx
Copy link

seanzxx commented Oct 22, 2016

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

@mritd
Copy link
Author

mritd commented Oct 22, 2016

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

@mritd mritd closed this as completed Oct 22, 2016
@v2ray
Copy link
Collaborator

v2ray commented Dec 2, 2016

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

@mritd
Copy link
Author

mritd commented Dec 3, 2016

好的感谢

@gexinworks
Copy link

@seanzxx ,确实是这个问题~

3gZ2jA pushed a commit to 3gZ2jA/v2ray-core that referenced this issue Oct 8, 2020
@dun11
Copy link

dun11 commented Mar 2, 2022

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

It works, thank you!

@mritd
Copy link
Author

mritd commented Mar 3, 2022

现在已经对 go 了解了... 你可以直接 apk add libc6-compat 应该就行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants