Running rabbitmqadmin in docker fails

I cant get the rabbitmqadmin to work in my rabbitmq docker.

I have this Dockerfile:

  • docker cannot start container after reboot use '--restart-always'
  • pptpd in docker stop working after container is restarted
  • Continuous Deployment Using Travis CI and Docker
  • Emulate Bluetooth LE Adapter for Acceptance Testing
  • Docker volumes-from not working when launching container with -H host flat
  • What is the reporitory name when add docker task in Bamboo?
  • 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

  • Docker: Run command while another command is running
  • How to display the docker current configuration?
  • docker nginx load balancing not working with Azure
  • Where to see the Dockerfile for a docker image?
  • Docker how to start container with defined nameservers in /etc/resolv.conf
  • docker local host url not opening
  • One Solution collect form web for “Running rabbitmqadmin in docker fails”

    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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.