Heroku: deploying minio server with Dockerfile CMD failure

I am trying to deploy my minio server to heroku. This is my Dockerfile:

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

This works locally when I build and run it through docker (using these commands:)

docker build . -t testheroku
sudo docker run -p 8080:8080 testheroku

The Dockerfile is the only file in the directory.

Then, I try to push it to heroku. I followed the commands on the heroku docker instruction page to install the heroku container plugin, login, etc. Then, I pushed my app with: heroku container:push web --app APP_NAME

When I visit the app, I get an application error in browser. This is what the heroku logs display:

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

For those unfamiliar with minio, some explanation of ‘server /data’ is not a minio sub-command. See ‘minio --help’.: this shows when you run the minio command with an argument that isn't a minio command. For example,

./minio sadf
‘sadf’ is not a minio sub-command. See ‘minio --help’.

So what heroku is telling me is that it's interpreting the CMD line from my Dockerfile, not as it should (which is with server as the minio subcommand and /data as its argument) but instead, if you notice the quotation marks, heroku is smashing the two pieces together and attempting to use the whole string as a minio subcommand - hence the error message. It's trying to run the command minio 'server /data' instead of minio server /data

Has anyone seen this kind of behavior from heroku before with a Dockerfile? How can I make sure that the CMD line gets interpreted correctly, and not as one full string? I assume this is a heroku issue because it runs fine locally. Any advice would be welcome.


Solution 1:

I had a similar issue that seemed to be caused by having other ENTRYPOINTS in the parent layers. To solve this, I added ENTRYPOINT [] above my CMD and everything worked fine.