[SERVER-37482] Mongo runninng from autorestarting docker fails authentication Created: 05/Oct/18 Updated: 12/Oct/18 Resolved: 12/Oct/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Admin |
| Affects Version/s: | 4.0.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Martin Drozdik | Assignee: | Nick Brewer |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Operating System: | ALL |
| Steps To Reproduce: | Start an unsecured mongo container. docker run --volume ~/test-data:/data/db --publish --name mongo-unauthenticated 27017:27017 mongo:4.0.2 Connect to it and create some users: , "readWriteAnyDatabase" ] ] Now take the unsecured mongo offline: docker stop mongo-unauthenticated And put a secured version in place. Note the `--restart always` flag that causes the container to autostart. docker run --restart always --publish 27017:27017 --name test-mongo -v ~/test-data:/data/db mongo:4.0.2 --auth Check that you can connect with valid credentials: mongo --port 27017 -u "tester" -p "password" --authenticationDatabase "test" Make a clean shutdown: docker stop mongo-unauthenticated Restart your computer. reboot Check that the `--restart always` works. docker ps And get the authentication failed with pristine credentials. mongo --port 27017 -u "tester" -p "password" --authenticationDatabase "test" |
| Participants: |
| Description |
|
Dear developers, I am not quite sure if this is on topic here, but it might interest you. I am running a mongodb docker container on my machine and I want to have it start when I start my computer. However, each time I boot my computer I have to do a docker restart of the container because the "automatically started" container slaps me with an Authentication failed when I give it valid credentials. Manually restarting the offending container solves the problem immediately. I am running an Ubuntu 18.04 system, on an encrypted partition, with the latest docker and MongoDB 4.0.2 (althought I had this problem with every version I tried). Oddly enough, this problem does not occur on an unencrypted partition. I would like to know if this could possibly be caused by the encryption of the partition (During Ubuntu installation you have the choice to encrypt). |
| Comments |
| Comment by Kelsey Schubert [ 12/Oct/18 ] |
|
Thanks for the update, drozdik.svk@gmail.com! |
| Comment by Martin Drozdik [ 10/Oct/18 ] |
|
Hi Nick, thanks for your investigation. I was unable to reproduce the problem on an unencrypted partition. That is good news. My best guess is that this is a misunderstanding between Ubuntu and Docker and has nothing to do with Mongo. However, my intuitions rarely prove correct. All the best! MD |
| Comment by Nick Brewer [ 05/Oct/18 ] |
|
drozdik.svk@gmail.com Thanks for your report - I can see you also posted this on StackOverflow. That's likely to be a more appropriate place for this question, as the variable of the encrypted partition leads me to believe this isn't a mongod bug. However I'm curious to know if you encounter any errors if the Docker container is started automatically, without encryption enabled? Thanks, |