0

I am currently unable to connect to mongo when I run docker-compose, I keep on getting the error below

connect EHOSTUNREACH 172.25.0.2:27017

Here is my docker-compose.yml file

version: "3.4"
services: 
    app:
        container_name: checki
        restart: always
        build:
          context: .
          network: host
        ports: 
          - "3000:9000"
        links: 
          - mongo
    mongo:
        container_name: mongo
        image: mongo
        volumes:
          - ./data:/data/db
        ports: 
          - "27018:27017"

and my db connection string is like this

"mongodb://mongo:27017/checki"

Please assist

Fehmy
  • 65
  • 10
  • If you wait 30-60 seconds, does it start up? (Do you see MongoDB startup logs in the `docker-compose up` output after the application failure?) – David Maze May 12 '21 at 16:00
  • I can see the logs `mongo | {"t":{"$date":"2021-05-12T15:42:40.391+00:00"},"s":"I", "c":"NETWORK", "id":23016, "ctx":"listener","msg":"Waiting for connections","attr":{"port":27017,"ssl":"off"}}` it does not startup at all – Fehmy May 12 '21 at 16:05

0 Answers0