I am running MongoDB in a container. Here are the details of the image that was used:
REPOSITORY TAG IMAGE ID CREATED SIZE
bitnami/mongodb 5.0 9829d217910c 2 days ago 577MB
It is part of the Rocket chat docker installation. From the compose.yml
file, here is the relevant code for the Mongodb container:
mongodb:
image: docker.io/bitnami/mongodb:${MONGODB_VERSION:-5.0}
restart: always
volumes:
- mongodb_data:/bitnami/mongodb
environment:
MONGODB_REPLICA_SET_MODE: primary
MONGODB_REPLICA_SET_NAME: ${MONGODB_REPLICA_SET_NAME:-rs0}
MONGODB_PORT_NUMBER: ${MONGODB_PORT_NUMBER:-27017}
MONGODB_INITIAL_PRIMARY_HOST: ${MONGODB_INITIAL_PRIMARY_HOST:-mongodb}
MONGODB_INITIAL_PRIMARY_PORT_NUMBER: ${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}
MONGODB_ADVERTISED_HOSTNAME: ${MONGODB_ADVERTISED_HOSTNAME:-mongodb}
MONGODB_ENABLE_JOURNAL: ${MONGODB_ENABLE_JOURNAL:-true}
ALLOW_EMPTY_PASSWORD: ${ALLOW_EMPTY_PASSWORD:-yes}
expose:
- 27017
ports:
- 27017:27017
Doing a docker logs <id>
shows it is running into this issue:
errorClass [Error]: [An error occurred when creating an index for collection "users: getaddrinfo ENOTFOUND mongodb]
at Collection.createIndex (packages/mongo/collection.js:801:15)
at setupUsersCollection (packages/accounts-base/accounts_server.js:1777:9)
at new AccountsServer (packages/accounts-base/accounts_server.js:75:5)
at packages/accounts-base/server_main.js:7:12
at module (packages/accounts-base/server_main.js:19:31)
at fileEvaluate (packages/modules-runtime.js:336:7)
at Module.require (packages/modules-runtime.js:238:14)
at require (packages/modules-runtime.js:258:21)
at /app/bundle/programs/server/packages/accounts-base.js:2193:15
at /app/bundle/programs/server/packages/accounts-base.js:2200:3
at /app/bundle/programs/server/boot.js:369:38
at Array.forEach (<anonymous>)
at /app/bundle/programs/server/boot.js:210:21
at /app/bundle/programs/server/boot.js:423:7
at Function.run (/app/bundle/programs/server/profile.js:256:14)
at /app/bundle/programs/server/boot.js:422:13 {
isClientSafe: true,
error: 'An error occurred when creating an index for collection "users: getaddrinfo ENOTFOUND mongodb',
reason: undefined,
details: undefined,
errorType: 'Meteor.Error'
}
The containers keep restarting. Here is my .env
file:
Rocket.Chat configuration
# Rocket.Chat version
# see:- https://github.com/RocketChat/Rocket.Chat/releases
RELEASE=6.2.5
# MongoDB endpoint (include ?replicaSet= parameter)
#MONGO_URL=
# MongoDB endpoint to the local database
#MONGO_OPLOG_URL=
# IP to bind the process to
BIND_IP=192.168.1.174
# URL used to access your Rocket.Chat instance
ROOT_URL=http://192.168.1.174:3001
# Port Rocket.Chat runs on (in-container)
#PORT=
# Port on the host to bind to
HOST_PORT=3001
### MongoDB configuration
# MongoDB version/image tag
#MONGODB_VERSION=
### Traefik config (if enabled)
# Traefik version/image tag
#TRAEFIK_RELEASE=
# Domain for https (change ROOT_URL & BIND_IP accordingly)
#DOMAIN=
# Email for certificate notifications
#LETSENCRYPT_EMAIL=