adminMongo icon indicating copy to clipboard operation
adminMongo copied to clipboard

Docker image not connecting to MongoDB and not reading environment variables

Open MikyStar opened this issue 6 years ago • 3 comments

Hello !

I've been developping my backend on localhost the all time using adminMongo to check if everything is correct but now that I'm dockerizing my application, adminMongo seems to not work as before :

In my docker-compose.yml I specify that adminMongo "depends_on" and "links" to the mongo image, I've also provide in environment variables a password and a context but while launching adminMongo first of all it's not using the context (if I go to the URL it supposed to be there's nothing), so I go where the logs say I should go (0.0.0.0/1234). It's not asking me for the password, but also it's not connecting to the database either. If I provide the authentification URL to mongo that I've been using in localhost (with the user and the password used in mongo image environment variables MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD) and just replace the address by the name of the container it says authentification error.

I really want to stress that it worked in localhost before, the password, the connection, everything (and it's awesome =D ). My backend is also working through Docker, I can send a API request to it and have a response.

For me it's really the Docker image that have a problem or maybe I'm missing something ...

Thank you for your attention, I'll close this issue and explain the solution if I find by my own but it's been a while since I'm blocked there ....

MikyStar avatar Aug 01 '18 07:08 MikyStar

Do you have these entries under the environment section of your adminMongo service in your docker-compose.yaml file?

  • CONN_NAME=admin-connection
  • DB_HOST=mongo
  • DB_PORT=27017

ayovev avatar Sep 27 '18 05:09 ayovev

I posted issue #224 which is related, before seeing this one. docker-compose doesn't allow this syntax with version 3.3

ERROR: yaml.scanner.ScannerError: mapping values are not allowed here in "./docker-compose-db.yml", line 49, column 19

so you need:

 environment:
   CONN_NAME: test
   DB_HOST: mongodb
   DB_PORT: 27017

but it doesn't do anything for me.

thomasd3 avatar Oct 07 '18 16:10 thomasd3

Hi!

I'm trying to set CONTEXT in docker-compose enviroment, and likes env var are not read.

I can see the CONTEXT var value on container, but mongoadmin stills listen on /.

    image: mrvautin/adminmongo
    environment:
      - CONTEXT=logs
      - PORT=1235

adminMongo listening on host: http://0.0.0.0:1235

NODE_VERSION=10.6.0
CONN_NAME=app-mercarural
YARN_VERSION=1.7.0
HOSTNAME=e0abd363e0f5
SHLVL=1
HOME=/root
PORT=1235
TERM=xterm
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
CONTEXT=logs
PWD=/app/user```

ruben-mv avatar Nov 30 '18 16:11 ruben-mv