如何让mongo-express在docker-compose中等待mongo

时间:2018-09-17 23:08:57

标签: mongodb docker docker-compose

我正在使用healthcheck / mongo,让mongo-express在那儿等待service_healthy。为什么不等待,浏览器中localhost:8081的结果是404? :(

#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 个答案:

没有答案