Running rabbitmqadmin in docker fails

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

I have this Dockerfile:

  • Bundle install fails in Rails Docker container
  • env file-named volume in docker-compose
  • Error Running Dockerrun.aws.json file ERROR: ValueError :: Extra data
  • mount /var/log in docker-compose
  • Flannel network partitions
  • How can I use environment variables in a docker run command?
  • 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 - Cassandra with Authentication
  • PHP `getEnv` is able to read System Environment Variable
  • Cleaning up after multiple docker inserts
  • Eliminate mess with docker swarm mode loadbalancer, consul and external load balancer
  • Dockerfile - Local Standard Appengine
  • no editor found (editor path = /usr/bin/editor) running visudo
  • 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.