How to get mongo-express to wait for mongo in docker-compose

Viewed 1063

I'm using the healthcheck/mongo and have mongo-express waiting on service_healthy there. Why does it not wait and the result at localhost:8081 is 404 in the browser? :(

#Docker Engine: 18.06.1-ce
#docker-compose: 1.22.0, build f46880f

version: '2.1'

services:
  mongodb:
    image: healthcheck/mongo:latest
    restart: always
    environment:
      - MONGO_INITDB_ROOT_USERNAME=root
      - MONGO_INITDB_ROOT_PASSWORD=rootpass
    ports:
     - "27017:27017"
    volumes:
     - "./mongo/data:/data/db"

  mongo-express:
    image: mongo-express
    restart: always
    depends_on:
      mongodb:
        condition: service_healthy
    ports:
      - "8081:8081"
    environment:
      - ME_CONFIG_MONGODB_ADMINUSERNAME=root
      - ME_CONFIG_MONGODB_ADMINPASSWORD=rootpass
0 Answers
Related