gpt4 book ai didi

mongodb - mongo-express 不是以 docker-compose 文件开头

转载 作者:行者123 更新时间:2023-12-05 02:41:26 25 4
gpt4 key购买 nike

下面是我的 docker-compose.yml 文件。

version: '3.1'
services:
mongodb:
image: mongo
ports:
- 27017:27017
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=admin
mongo-express:
image: mongo-express
ports:
- 8081:8081
environment:
- ME_CONFIG_MONGODB_ADMINUSERNAME=root
- ME_CONFIG_MONGODB_ADMINPASSWORD=admin
- ME_CONFIG_MONGODB_SERVER=mongodb
depends_on:
- mongodb
restart: on-failure

我遇到错误:

Could not connect to database using connectionString: mongodb://root:admin@mongodb:27017/" in mongo-express. PFA-1The root user is created after error shown in mongo-express. PFA-2is the issue because mongo-express executed before mongodb?

enter image description here

enter image description here

最佳答案

对我来说,正是这一部分让 mongo express 开始了:

mongo-express:
image: mongo-express
restart: always
...

关于mongodb - mongo-express 不是以 docker-compose 文件开头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68116744/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com