Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongo:5.0.3 - Failed to run container with initdb #509

Open
Ap4uPNZ opened this issue Nov 12, 2021 · 2 comments
Open

mongo:5.0.3 - Failed to run container with initdb #509

Ap4uPNZ opened this issue Nov 12, 2021 · 2 comments
Labels
question Usability question, not directly related to an error with the image

Comments

@Ap4uPNZ
Copy link

Ap4uPNZ commented Nov 12, 2021

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

@Ap4uPNZ Ap4uPNZ changed the title Failed to run container with initdb mongo:5.0.3 - Failed to run container with initdb Nov 12, 2021
@yosifkit yosifkit transferred this issue from docker-library/docs Nov 13, 2021
@yosifkit
Copy link
Member

  1. it doesn't make sense to try to add an admin user/pass to a shard server, since they don't store the admin database (that's on the config server). It also doesn't make sense to try to run any scripts in /docker-entrypoint-initdb.d/, since, as far as I understand it, you need to go through a mongos server in order to talk to a sharded cluster.
    • so, we should probably adjust the entrypoint script to either warn & ignore if any of that is attempted on a shardsvr or just error out if they are supplied with shardsvr
  2. as for user/pass with configsvr, that still works for 4.4, but replica set being required in 5.0 complicates things.
    • since replSet does not work correctly on the temporary mongod server, we should also remove configsvr but preserve its default dbPath for the temporary mongod server so that data is in the correct location

@yosifkit
Copy link
Member

Finally have a PR to address the configsvr half of this issue: #600.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

No branches or pull requests

3 participants