Running rabbitmqadmin in docker fails

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

I have this Dockerfile:

  • COREOS error on Bare Metal Server (unix socket /var/run/docker.sock does not exist)
  • How do you do an ElasticBeanstalk deploy for multiple docker containers?
  • distribute docker containers evenly with kubectl
  • Docker WordPress - Wrong URL
  • Docker EC2 & port binding
  • Docker: hashicorp/boot2docker fails to download behind corporate proxy
  • 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

  • Create Docker container with both Java and Node.js
  • Vagrant would not provision docker
  • Adding a Local GIT Repository to a Gogs Docker Container
  • Prevent docker from creating image from cache
  • Docker container unable to resolve localhost
  • Golang connect to docker connect to my sql docker getsockopt: connection refused
  • 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.