docker-library / docker-library/mongo

mongo:5.0.3 - Failed to run container with initdb

Open
#509 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Shell
Stars
1.1k
Forks
658
Avg merge
4h 40m
Merged PRs (30d)
1

Description

Step to reproduce
docker run --rm -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=root mongo:5.0.3 mongod --shardsvr --replSet a
or
docker run --rm -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=root mongo:5.0.3 mongod --configsvr --replSet a

Actual result

BadValue: Cannot start a shardsvr as a standalone server. Please use the option --replset to start the node as a replica set.
try 'mongod --help' for more information

Starts from 5.0.3 mongod requires replica set for shardsvr or configsvr cluster role (issue - https://jira.mongodb.org/browse/SERVER-27383)

It is caused by this code: https://github.com/docker-library/mongo/blob/master/5.0/docker-entrypoint.sh#L286

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at 5.0/docker-entrypoint.sh around line 286 and reproduce the issue with the two mongo:5.0.3 docker commands in the report. Check how the entrypoint handles shardsvr and configsvr when --replSet is supplied; done means both commands can start with the requested initialization environment without the standalone-server error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, mongodb, shell
Domain
databases, devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.