Mongodb INFO ==> Validating settings in MONGODB_* env vars | Bitnami stuck loading error

Hello, I am a user of a MacBook M1 pro, I use the following dependencies:

  1. Docker version 20.10.12
  2. Docker Compose version 1.29.2
  3. Node version v17.6.0
  4. Bitnami version: ‘bitnami/mongodb:5.0.8’
  5. Docker-compose.yml version: ‘3.9’

My error happens when I run the command “docker-compose up -d” and the bitnami image gets stuck, as it fails to initialize, my application fails.

docker logs -f mongodb
mongodb 15:30:51.61 
mongodb 15:30:51.64 Welcome to the Bitnami mongodb container
mongodb 15:30:51.66 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mongodb
mongodb 15:30:51.68 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mongodb/issues
mongodb 15:30:51.70 
mongodb 15:30:51.72 INFO  ==> ** Starting MongoDB setup **
mongodb 15:30:51.91 INFO  ==> Validating settings in MONGODB_* env vars...

docker logs -f becatron
Debug: Server is running on port 3005
MongooseServerSelectionError: connect ECONNREFUSED 172.23.0.2:27017
    at NativeConnection.Connection.openUri (/becatron-app/node_modules/mongoose/lib/connection.js:807:32)

This is my code in docker-compose.yml:

version: '3.9'

services:
# Database service
      mongodb:
          image: 'bitnami/mongodb:5.0.8'
          container_name: mongodb
          restart: on-failure
          environment:
            - MONGODB_ROOT_USER=${MONGODB_ROOT_USER}
            - MONGODB_ROOT_PASSWORD=${MONGODB_ROOT_PASSWORD}
            - MONGODB_USERNAME=${MONGODB_USERNAME}
            - MONGODB_PASSWORD=${MONGODB_PASSWORD}
            - MONGODB_DATABASE=${MONGODB_DATABASE}
          ports:
                  - "27017:27017"

# Application service
      becatron:
              depends_on:
                      - mongodb
              links:
                      - mongodb
              build:
                      context: ./becatron_app
              env_file:
                      - ./.env
              container_name: becatron
              ports:
                      - "${PORT}:${PORT}"

So, what could be?, anyone know what happen or what i’m doing bad?, the same code in a virtual machine with linux run perfectly. Probably it’s an image error?

Thanks in advance.

3 Likes

Having the same issue, M1 Macbook Pro

Same issue - it appears to be specific to m1, however, it did seem to work previously with mongo 5 also.

After some research, I found the Bitnami image of mongodb is not supported yet on the M1 machines. More info on this thread:

There is a workaround which involves a 3rd party compat image found here:

It is not recommended for use in production however, so it is not a full replacement for our needs. However, it is enough to get a dev environment up and running.