V
V
Valderan2021-07-21 02:27:51
MongoDB
Valderan, 2021-07-21 02:27:51

Docker: Node + Mongo - crashes at startup (mongo exited with code 132) - what could be?

Hello everyone, there was a problem when starting the Node + Mongo container, the assembly is very basic, there are no difficulties.
After the start, the service with nodejs rises and works stably, the mongodb service issues: mongo exited with code 132, falls and goes into a restart. Accordingly, the node service does not see mongo and crashes with an error getaddrinfo ENOTFOUND mongo
to raise the mongo service docker run --name mongo -d mongo:latestseparately, it is also not possible.

A question for the "GURU" - who faced a similar error and how did he treat it?

In nets, people write that in the absence of support for the sse4.2 processor, this often happens, but my processor supports:

cat /proc/cpuinfo | grep sse4_2
... sse4_1 sse4_2...


docker-compose.yml:
version: "3.8"

services:
  api:
    build: ./api
    command: npm run start
    restart: unless-stopped
    ports:
      - "3000:3000"
    environment:
      - PORT=3000
      - MONGO_URL=mongodb://mongo:27017/api
    links:
      - mongo
    depends_on:
      - mongo
    environment:
      WAIT_HOSTS: mongo:27017

  mongo:
    container_name: mongo
    image: mongo
    restart: unless-stopped
    ports:
      - "27017:27017"


Dockerfile:
FROM node:14.17.3-alpine

WORKDIR /usr/src/app

COPY package*.json ./

RUN npm install

COPY . .


Well, the console for completeness:
Successfully tagged docker_api:latest
mongo is up-to-date
Starting docker_api_1 ... done
Attaching to mongo, docker_api_1
api_1    | 
api_1    | > [email protected] start /usr/src/app
api_1    | > node src/index.js
api_1    | 
api_1    | MONGO_URI:  mongodb://mongo:27017/api
mongo exited with code 132
api_1    | e:  MongooseServerSelectionError: getaddrinfo ENOTFOUND mongo
...

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Valderan, 2021-07-21
@valderan

The problem was solved by replacing the image with a stable one, the latest version did not fit.
docker pull mongo:4.4.7-focal

R
Rag'n' Code Man, 2021-07-21
@iDmitriyWinX

According to this gist , your error 132 is:
OBSOLETE_CONFIG_SERVERS_INCONSISTENT
I have no idea what this means, but check your config servers (I don't know if you have them, but monga thinks they do :) )

S
sergey, 2021-07-21
kuzmin @sergueik

replace latest mongo container base image with stable tag like mongo:4.4

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question