2017-10-19 38 views
2

在我的遠程服務器,我使用的是碼頭工人容器開始:無法登錄到MongoDB的與登錄泊塢窗,撰寫容器/通

MONBULDING_PORT="8080" docker-compose up -d --no-deps --build monbulding-mongo

它工作得很好,如果我不設置任何用戶名/密碼進行身份驗證。 下面是相應的docker-compose.yaml文件:

monbulding-mongo: 
    image: mongo:latest 
    ports: 
    - "27017:27017" 

現在,如果我想設置一個用戶名/密碼來訪問MongoDB中,我修改了這個文件到:

monbulding-mongo: 
    image: mongo:latest 
    ports: 
    - "27017:27017" 
    environment: 
    - AUTH=yes 
    - MONGODB_ADMIN_USER=admin 
    - MONGODB_ADMIN_PASS=password 
    - MONGODB_APPLICATION_DATABASE=app 
    - MONGODB_APPLICATION_USER=user 
    - MONGODB_APPLICATION_PASS=password 

如果我嘗試登錄在使用Robo 3T到MongoDB,它不起作用:enter image description here

有人知道我做錯了什麼? 謝謝!

編輯: 我也試圖與mongo shell

mongo --host domain.net -u admin -p password

但有一個錯誤了。

+0

試試這個https://stackoverflow.com/questions/34559557/how-to-enable-authentication-on-mongodb-through-docker – Inforedaster

+0

我已經做了......:/ – LeCintas

+0

什麼是錯誤信息? – kotapeter

回答