3

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.

  • The `links:` option is obsolete, and in this setup you can delete it with no change to everything else. In some other questions it's seemed like it's made a difference in network connectivity. Does deleting the `links: [mongodb]` block make any difference? – David Maze Jun 06 '22 at 16:41
  • Hi @DavidMaze, i deleted the links label and nothing happen, the error is the same. –  Jun 07 '22 at 06:43

1 Answers1

3

The root issue due to Mongo Bitnami does not support m1. You can see detail here: https://github.com/bitnami/charts/issues/7305

Dk Asta
  • 31
  • 2
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 27 '23 at 20:45