I cant get the rabbitmqadmin to work in my rabbitmq docker.
I have this Dockerfile:
FROM rabbitmq:3-management
RUN apt-get update && apt-get install -y python
ADD rabbitmqadmin /usr/local/bin/rabbitmqadmin
ADD rabbitconf.json /rabbitconf.json
RUN chmod 755 /usr/local/bin/rabbitmqadmin
CMD ["/usr/local/bin/rabbitmqadmin -q import /rabbitconf.json"]
Build it like this:
docker build --tag=myrabbit .
Run it like this:
docker run -d -p 8080:15672 myrabbit
It does not work... The log shows:
/docker-entrypoint.sh: line 8: /usr/local/bin/rabbitmqadmin -q import /rabbitconf.json: No such file or directory
What am I doing wrong ?
BR
You've mixed up the shell and exec formats for the CMD
instruction.
CMD /usr/local/bin/rabbitmqadmin -q import /rabbitconf.json
Should work.
For more information see http://docs.docker.com/reference/builder/#cmd.
I'll leave the following for anyone else debugging similar problems:
The parent image rabbitmq:3-management
is declares an ENTRYPOINT
which runs the docker-entrypoint.sh
script. Your CMD
instruction is passed to this ENTRYPOINT
script as an argument. Somewhere in the script, things go wrong.
Without seeing the script, we can't really debug the problem. However, one workaround would be to override the ENTRYPOINT
instruction either in your Dockerfile or on the command line. For example, what happens if you run:
docker run -d -p 8080:15672 --entrypoint="" myrabbit
Note that this isn't the correct solution; you should try to use the ENTRYPOINT
script of the parent image, or fix it so that it does what you want.