我正在尝试将minio服务器部署到heroku。这是我的Dockerfile:

FROM minio/minio
ENV MINIO_ACCESS_KEY="xxxxxx"
ENV MINIO_SECRET_KEY="xxxxxxxx"
CMD ["server", "/data"]
EXPOSE 9000

当我通过docker构建并运行它时,可以在本地使用(使用以下命令:)
docker build . -t testheroku
sudo docker run -p 8080:8080 testheroku

Dockerfile是目录中的唯一文件。

然后,我尝试将其推送到heroku。我按照heroku docker instruction page上的命令安装了heroku容器插件,登录名等。然后,我用以下命令推送了我的应用程序:heroku container:push web --app APP_NAME
当我访问该应用程序时,在浏览器中出现应用程序错误。这是heroku日志显示的内容:
2017-09-21T02:24:47.589576+00:00 app[api]: Deployed web (26b84915ed48) by user []
2017-09-21T02:24:47.589576+00:00 app[api]: Release v28 created by user []
2017-09-21T02:24:48.241050+00:00 heroku[web.1]: State changed from crashed to starting
2017-09-21T02:24:49.480733+00:00 heroku[web.1]: Starting process with command `server /data`
2017-09-21T02:24:51.961825+00:00 app[web.1]: ‘server /data’ is not a minio sub-command. See ‘minio --help’.
2017-09-21T02:24:52.056706+00:00 heroku[web.1]: Process exited with status 1
2017-09-21T02:24:52.064400+00:00 heroku[web.1]: State changed from starting to crashed
2017-09-21T02:24:52.938136+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=APP_NAME.herokuapp.com request_id=80ddd6f8-c053-4ff6-b4c9-fdb0ce8a48a5 fwd="67.245.14.153" dyno= connect= service= status=503 bytes= protocol=https
2017-09-21T02:24:54.319660+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=APP_NAME.herokuapp.com request_id=9988b6af-8a91-4e77-9bd4-c79c9e2ec24c fwd="67.245.14.153" dyno= connect= service= status=503 bytes= protocol=https

对于那些不熟悉minio的人,对‘server /data’ is not a minio sub-command. See ‘minio --help’.进行了一些解释:当您使用不是minio命令的参数运行minio命令时,将显示此信息。例如,
./minio sadf
‘sadf’ is not a minio sub-command. See ‘minio --help’.

所以heroku告诉我的是,它是从我的Dockerfile中解释CMD行,而不是应有的(这是server作为minio子命令,而/data作为其参数),但是,如果您注意到引号,heroku会将两段在一起,并尝试将整个字符串用作minio子命令-因此出现错误消息。它正在尝试运行命令minio 'server /data'而不是minio server /data
有人在使用Dockerfile之前从heroku中看到过这种行为吗?如何确保正确解释CMD行,而不是完整字符串?我认为这是一个heroku问题,因为它在本地运行良好。任何的建议都受欢迎。

最佳答案

我有一个类似的问题,似乎是由父层中的其他ENTRYPOINTS引起的。为了解决这个问题,我在CMD上方添加了ENTRYPOINT [],一切正常。

09-30 14:04