D
D
drowzeenico2019-09-30 14:17:07
MongoDB
drowzeenico, 2019-09-30 14:17:07

Why doesn't docker-compose start Mongo correctly on MacOs?

Good day. There is a backend-API that works with MongoDB and for the convenience of development, all this is packaged in containers that are launched using docker-compose. First, the Mongo container starts, and then the backend starts and connects to Mongo. On Linux everything works fine and no problems. But developers on MacOs have constant problems with this scheme: MongoDB diligently does not want to start as it should, and because of this, there is always a connection error.
I don’t really know what to cling to, but when you do

docker inspect mongo
, then in the Networks section there is neither an associated Ip nor a Gateway, even the NetworkID has an empty value. Maybe some network problem.
Has anyone come across? What could be the problem? And how to properly cook dockers with poppy? ))
UPD: docker-compose.yml
version: '3'

services:
  backend:
    container_name: 'backend'
    build: ./src
    env_file:
      - ./src/.env
    volumes:
      - ./src:/srv/
      - /srv/node_modules/
    ports:
      - 3000:3000
    depends_on:
      - mongo
    links: 
      - mongo
  
  mongo:
    image: mongo:latest
    container_name: 'mongodb'
    environment:
      - MONGO_DATA_DIR=/data/db
      - MONGO_LOG_DIR=/data/logs
    volumes:
      - ./data/db:/data/db
    ports:
      - 27017:27017
    command: mongod --logpath=/dev/null

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Vasilyev, 2019-10-01
@vasilyevmn

Similar to your case https://github.com/docker/for-mac/issues/3448
As a possible solution:

Downgrading to 18.06.0-ce-mac70 2018-07-25 solved my problem

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question