gpt4 book ai didi

docker - 在 Windows 容器中运行 erlang 时出错

转载 作者:行者123 更新时间:2023-12-02 06:36:58 25 4
gpt4 key购买 nike

我正在尝试在 Windows 容器中启动并运行 RabbitMQ,但运气不佳。我已将 RabbitMQ 和 Erlang 的安装目录复制到容器中,但是当我尝试运行 erl.exe 时,我被告知 beam.smp.dll 无法运行待加载。

PS C:\Program Files\erl8.2\bin> .\erl.exe
Unable to load emulator DLL
(C:\Program Files\erl8.2\erts-8.2\bin\beam.smp.dll)

在主机上的同一安装目录上运行相同的命令效果很好。我已检查该文件是否存在并且校验和是否匹配。我敢打赌,容器加载文件的方式和主机加载文件的方式存在一些细微的差异。我只是不知道从哪里开始寻找。

最佳答案

这是我的 Dockerfile,它可以工作。我可以连接到 RabbitMQ,日志显示它正在正确运行,并且我可以使用容器的 IP/主机名从我的主机使用 guest / guest 登录来登录管理 UI。

# start with this container as the base
FROM microsoft/windowsservercore

# erlang installer download url
ENV erlang_download_url "http://erlang.org/download/otp_win64_19.3.exe"

# erlang will install to this location and rabbitmq will use this environment variable to locate it
ENV ERLANG_HOME c:\\erlang

# rabbitmq version used in download url and to rename folder extracted from zip file
ENV rabbitmq_version "3.6.9"

# rabbitmq zip package download url
ENV rabbit_download_url "https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.9/rabbitmq-server-windows-$rabbitmq_version.zip"

# setup powershell options for RUN commands
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# download and install erlang using silent install option, and remove installer when done
RUN Invoke-WebRequest -Uri $env:erlang_download_url -OutFile erlang_install.exe ; \
Start-Process -Wait -FilePath .\erlang_install.exe -ArgumentList /S, /D=$env:ERLANG_HOME ; \
Remove-Item -Force erlang_install.exe

# download and extract rabbitmq, and remove zip file when done
RUN Invoke-WebRequest -Uri $env:rabbit_download_url -OutFile rabbitmq.zip ; \
Expand-Archive -Path .\rabbitmq.zip -DestinationPath "c:\\" ; \
Remove-Item -Force rabbitmq.zip

# remove version from rabbitmq folder name
RUN Rename-Item c:\rabbitmq_server-$env:rabbitmq_version c:\rabbitmq

# enable managment plugin
RUN c:\rabbitmq\sbin\rabbitmq-plugins.bat enable rabbitmq_management --offline

# tell rabbitmq where to find our custom config file
ENV RABBITMQ_CONFIG_FILE "c:\rabbitmq"
RUN ["cmd", "/c", "echo [{rabbit, [{loopback_users, []}]}].> c:\\rabbitmq.config"]

# run server when container starts - container will shutdown when this process ends
CMD "c:\rabbitmq\sbin\rabbitmq-server.bat"

关于docker - 在 Windows 容器中运行 erlang 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42620573/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com