Trying to send messages between Docker containers using rabbitmq

I’m currently experimenting with Docker and rabbitmq using the Java client, and I’m trying to figure out how to send a simple message i.e. “Hello world” between one container holding the Send class, to a second container running the rabbitmq server, and then to a third container holding the Receive class. Can anyone help with trying to set this up or if this isn’t actually possible?
So far what I’ve done is on the send and receive containers I’m running Ubuntu with Java installed and with the java client in the memory, and I have these both linked through the link command to the server container. On trying to run either class I get a number of “unable to connect” errors, and don’t know how to solve it. If anyone could help that would be great. Thanks!

*Edit

  • Docker Ubuntu 16 on a Ubuntu 14 machine : no Internet connection
  • Docker Compose - symlink in deployment
  • ssh-keyscan not found in Dockerfile
  • Volume sharing in Docker and Virtualbox
  • what's the docker pattern of serving both static and dynamic content
  • Docker Swarm and private IP
  • I’m trying to run just the simple send and receive classes from the rabbitmq tutorial. For the send container the Dockerfile I’m using is

    FROM ubuntu
    RUN apt-get update
    RUN apt-get install software-properties-common -y
    RUN add-apt-repository ppa:webupd8team/java -y
    RUN apt-get update
    RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
    RUN apt-get install oracle-java8-installer -y
    RUN apt-get install oracle-java8-set-default
    ADD Send.class /usr/
    ADD rabbitmq-java-client-bin-3.5.3.zip /usr/
    

    And similar for the Receive container.
    I’m starting the rabbitmq server container with

    docker run --name server1 rabbitmq:3
    

    then starting the send container with

    docker run -i -t -d -P --name send --link server1 sendtest
    

    Inside the send container I unzip the java client, then try to run the send class but get the connection refused error. I know there’s something I’m missing, just not sure what it is.
    Thanks

  • Docker not supported on 32-bit OS
  • Bluemix: local Docker daemon is not reachable to authenticate it
  • random error in docker when mounting a volume directory.
  • execute binary on linked container in docker
  • Mount Volume To User's Home Directory In Docker Container
  • XDebug: Windows + Docker + PHPStorm
  • One Solution collect form web for “Trying to send messages between Docker containers using rabbitmq”

    I have gotten this to work quite well using Docker Compose. If you want to use Docker run it should work too if you specify the ports in the rabbitMQ run. Something like

    docker run –expose 5672 -P –name server1 rabbitmq:3

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