我是MacBook M1 pro的用户,我使用以下依赖项:
- Docker版本20.10.12
- Docker Compose版本1.29.2
1.节点版本v17.6.0 - Bitnami版本:'bitnami/mongodb:5.0.8'
- Docker-compose.yml版本:'3.9'
我的错误发生在我运行命令“docker-compose up -d”和bitnami图像卡住,因为它无法初始化,我的应用程序失败。
docker logs -f mongodb
mongodb 15:30:51.61
mongodb 15:30:51.64 Welcome to the Bitnami mongodb container
mongodb 15:30:51.66 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mongodb
mongodb 15:30:51.68 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mongodb/issues
mongodb 15:30:51.70
mongodb 15:30:51.72 INFO ==> ** Starting MongoDB setup **
mongodb 15:30:51.91 INFO ==> Validating settings in MONGODB_* env vars...
docker logs -f becatron
Debug: Server is running on port 3005
MongooseServerSelectionError: connect ECONNREFUSED 172.23.0.2:27017
at NativeConnection.Connection.openUri (/becatron-app/node_modules/mongoose/lib/connection.js:807:32)
这是我在docker-compose.yml中的代码:
version: '3.9'
services:
# Database service
mongodb:
image: 'bitnami/mongodb:5.0.8'
container_name: mongodb
restart: on-failure
environment:
- MONGODB_ROOT_USER=${MONGODB_ROOT_USER}
- MONGODB_ROOT_PASSWORD=${MONGODB_ROOT_PASSWORD}
- MONGODB_USERNAME=${MONGODB_USERNAME}
- MONGODB_PASSWORD=${MONGODB_PASSWORD}
- MONGODB_DATABASE=${MONGODB_DATABASE}
ports:
- "27017:27017"
# Application service
becatron:
depends_on:
- mongodb
links:
- mongodb
build:
context: ./becatron_app
env_file:
- ./.env
container_name: becatron
ports:
- "${PORT}:${PORT}"
所以,什么可能是?,有人知道发生了什么事或我做的不好?,相同的代码在虚拟机与linux完美运行.可能是一个图像错误?
先谢了。
1条答案
按热度按时间jtw3ybtb1#
由于Mongo Bitnami不支持m1而导致的根本问题。您可以在此处查看详细信息:https://github.com/bitnami/charts/issues/7305