我在使用Erlang 20时遇到了连接问题。
我使用rebar3 as prod tar生成一个归档文件,并使用它构建一个基于erlang:20.2-alpine的docker映像。
在我的Macbook Pro上,可以调用bin/app start,但在目标docker容器上,它会告诉我:erts-9.2/bin/erlexec: line 1: syntax error: unexpected "("
Erlang在我的Macbook Pro上:
erl
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Eshell V9.2 (abort with ^G)目标容器上的Erlang:
erl
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V9.2 (abort with ^G)```发布于 2019-07-25 05:26:28
将忽略
_build目录的.dockerignore文件添加到项目中。
我今天遇到了这个问题。就像@steve-vinoski在评论中提到的那样,这确实与我在容器中运行macOS输出的事实有关,但就像@yuanbo han一样,我也是在Dockerfile中构建版本,所以我不知道为什么它不能工作。
然后我意识到,我的Dockerfile文件中有一个COPY . .指令,因为我没有.dockerignore,所以它会从我的mac中提取输出。解决方案是将以下.dockerignore文件添加到项目的根目录:
_build/
.elixir_ls/
.git/
.vscode/
deps/
priv/static/
test/
.dockerignore
.env
.formatter.exs
.gitignore
.travis.yml
Dockerfile
README.md发布于 2017-12-25 02:09:19
我参考了docker erlang,使用docker直接构建发布和目标镜像。
https://stackoverflow.com/questions/47951745
复制相似问题