frodenas / docker-mongodb

A Dockerfile that produces a Docker Image for MongoDB
Apache License 2.0
37 stars 46 forks source link

Authentication seems not to be working #4

Closed nei closed 7 years ago

nei commented 7 years ago

Hi Ferran,

I've tried to use your docker image but it seems the authentication is not working.

That is how I am using.

mongo:
    image: frodenas/mongodb:2.6
    ports:
      - ${AKENEO_MONGO_PORT}:27017
    environment:
      MONGODB_DBNAME: akeneo_pim
      MONGODB_USERNAME: akeneo_pim
      MONGODB_PASSWORD: akeneo_pim

It seems the database is up and the credentials were ok.

mongo_1   | 2017-02-24T09:40:58.120+0000 [conn2] command akeneo_pim.$cmd command: createUser { createUser: "akeneo_pim", pwd: "xxx", roles: [ { role: "dbOwner", db: "akeneo_pim" } ], digestPassword: false, writeConcern: { w: "majority", wtimeout: 30000.0 } } keyUpdates:0 numYields:0  reslen:37 110ms
mongo_1   | Successfully added user: {
mongo_1   |     "user" : "akeneo_pim",
mongo_1   |     "roles" : [
mongo_1   |         {
mongo_1   |             "role" : "dbOwner",
mongo_1   |             "db" : "akeneo_pim"
mongo_1   |         }
mongo_1   |     ]
mongo_1   | }
mongo_1   | 2017-02-24T09:40:58.125+0000 [conn2] end connection 127.0.0.1:43286 (0 connections now open)
....
mongo_1   | 2017-02-24T09:40:58.143+0000 [signalProcessingThread] shutdown: removing fs lock...
mongo_1   | 2017-02-24T09:40:58.143+0000 [signalProcessingThread] dbexit: really exiting now
mongo_1   | ========================================================================
mongo_1   | MongoDB User: "akeneo_pim"
mongo_1   | MongoDB Password: "akeneo_pim"
mongo_1   | MongoDB Database: "akeneo_pim"
mongo_1   | MongoDB Role: "dbOwner"
mongo_1   | ========================================================================
mongo_1   | Starting MongoDB...
mongo_1   | 2017-02-24T09:40:59.174+0000 [initandlisten] MongoDB starting : pid=29 port=27017 dbpath=/data 64-bit host=f402dd1b6804

but then when I try to connect I get this error:

root@b5532377add2:/var/www/akeneo# mongo mongo:27017/akeneo_pim -u akeneo_pim -p
MongoDB shell version: 2.4.10
Enter password:
connecting to: mongo:27017/akeneo_pim
Error while trying to show server startup warnings: not authorized on admin to execute command { getLog: "startupWarnings" }

Any idea what is wrong? thank you again

nei commented 7 years ago

Well it turns out that it is working. after the error there I still can execute command.. I've not realized that before. Do you think this error may have any effect?

frodenas commented 7 years ago

I've not been updating this image in a while, I recommend you using the official mongodb image.