Cannot access rabbitmq web admin from Docker container for Mac localhost

Viewed 3197

I recently installed Docker for Mac for a project that requires Docker, MongoDB container and RabbitMQ container. I am using a docker-compose.xml file to create the containers. So far I am able to access the MongoDB database from the container through localhost:27017.

However, I am not able to access the management plugin using localhost:15672. I am using the management image for RabbitMQ but this is not working at all. Here is a copy of my configuration file:

docker-compose-yml:

version: '2'
services:
 mongo:
    container_name: "mongo1"
    tty: true
    image: mongo:latest
    environment:
      - MONGO_DATA_DIR=/data/db
      - MONGO_LOG_DIR=/dev/null
      - MONGO_INITDB_ROOT_USERNAME=admin
      - MONGO_INITDB_ROOT_PASSWORD=***************
    volumes:
      - /data/db:/data/db
    ports:
        - 27017:27017
    command: "mongod --smallfiles --auth"
 rabbitmq:
    container_name: "rabbitmq1"
    tty: true
    image: rabbitmq:management
    ports:
      - "15672:15672"
      - "15671:15671"
      - "5672:5672"
    volumes:
      - /rabbitmq/lib:/var/lib/rabbitmq
      - /rabbitmq/log:/var/log/rabbitmq
      - /rabbitmq/conf:/etc/rabbitmq/

Generated rabbitmq.config:

[ { rabbit, [
        { loopback_users, [ ] },
        { tcp_listeners, [ 5672 ] },
        { ssl_listeners, [ ] },
        { hipe_compile, false }
] } ].

I looked at the Dockerfile for the management image and it seems to allow for "rabbitmq-plugins enable rabbitmq_management" in the file. I keep getting "Connection was reset" on the browser.

I am new to Docker and am not sure what could be causing this issue.

The only thing that seems to jump out to me is that in rabbitmq.config; I am not seeing an entry for the other ports, including 15672. Though this file is added by rabbitmq. Also, calling the docker-compose logs command is not showing any entries indicating the request was received.

Solution

Running this command from the shell solved the issue: docker exec [CONTAINER_NAME] rabbitmq-plugins enable rabbitmq_management from this website, https://github.com/docker-library/rabbitmq/issues/45. I thought using the image rabbitmq:management should solve this issue.

Why would running the rabbitmq:management image not address this?

0 Answers
Related