Docker for Windows can’t hit RabbitMQ ip unless port is bound to localhost

  docker, rabbitmq

Trying to build a dev environment for rabbitmq and some other services. Reading docker hub I should be able to access RabbitMQ management after getting the image found here (https://hub.docker.com/_/rabbitmq/) up by going to http://container-ip:15672 . That doesn’t work for me. If I expose port 15672 so localhost:15672 maps to the containers 15672 I can access expected output via http://localhost:15672. Still pretty new to docker so think there is something basic about the networking I’m missing here. I’d prefer to not bind ports on the localhost like that if possible.

Dockerfile

FROM rabbitmq:3-management

RUN apt-get update 
    && apt-get install -y --no-install-recommends vsftpd 
    && apt-get clean 
    && rm -rf /var/lib/apt/lists/*

RUN mkdir -p /var/run/vsftpd/empty 
 && mkdir -p /etc/vsftpd 
 && mkdir -p /var/ftp 
 && mv /etc/vsftpd.conf /etc/vsftpd.orig 
 && mkdir -p /etc/service/vsftpd

ADD vsftpd.sh /etc/service/vsftpd/run
VOLUME ["/var/ftp"]

EXPOSE 20-21
EXPOSE 65500-65515

DockerRun.bat

docker build -t dev-environment .
docker run -d --hostname my-rabbit --name some-rabbit -it dev-environment 
docker inspect --format "RabbitMQ management @ http://{{ .NetworkSettings.IPAddress }}:15672" some-rabbit

Output from docker inspect

docker inspect --format "RabbitMQ management @ http://172.17.0.2:15672" some-rabbit

Source: Docker Questions

LEAVE A COMMENT