How do I create a Docker container with a hostname that an other container can use?

So I’ve created a container for RabbitMq with the following command.

docker run -d --hostname my-rabbit --name some-rabbit rabbitmq:3-management

Which works fine, but I then created another container with the following command

  • How much maximum heap space does a Play Framework App use per default
  • Change Default Docker Image Download Location in Fedora 23
  • Union mounts into Docker containers
  • How to pass an argument to supervisord in docker?
  • ssh through container causes stdin: is not a tty
  • Socket connection into Docker initially succeeds then fails
  • docker run test .

    This runs a container with a PHP file that tries to connect to the hostname, my-rabbit but it can’t find it the host so the PHP just closes itself right away. I did, however, find out the IP of the my-rabbit( first container ) and replace the hostname( my-rabbit ) in my PHP code with the IP and it connects with no problems.

    So how do I create a hostname for the RabbitMq that all the other container on the same network can see and use instead of an IP?

  • BOM error, input not detected error
  • Docker compose and volumes with Apache
  • docker automatically commit and push
  • Docker daemon and DNS
  • Docker disk space leak
  • How can docker downloading new image output log messages can be supressed?
  • One Solution collect form web for “How do I create a Docker container with a hostname that an other container can use?”

    I found out the answer after making this post. I use the –link arg with docker run.

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