Running rabbitmqadmin in docker fails

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

I have this Dockerfile:

  • Docker - curl returned “connection reset”
  • Jenkins: Pipeline Docker Job with Jenkins file - Docker groovy syntax
  • Kill a running process like a webserver inside a Docker container without killing the container
  • Manipulating network traffic between containers in Docker in Docker environment without privileged mode?
  • Docker git clone on container launch?
  • Docker Container Library Duplication
  • 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

  • Deploy AngularJS app into docker container
  • Docker run syntax
  • import mysql data to kubernetes pod
  • Is it possible to commit only a subset of the changes to a docker image?
  • Persisting a dockerized WordPress (with LAMP stack)
  • Build and use docker image from docker-compose
  • 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.