why i can't change mongo-express's id/pw by using yaml file

49 Views Asked by At

hello thanks for watching. i have a problem login to mongo-express here is my yaml file

version: '3.1'

services:
  mongo:
    image: mongo
    container_name: mongo
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: admin
      MONGO_INITDB_ROOT_PASSWORD: yourpassword
    volumes:
      - mongo-db:/data/db
    networks:
      - mongo-network

  mongo-express:
    image: mongo-express
    container_name: mongo-express
    restart: always
    depends_on:
      - mongo
    environment:
      ME_CONFIG_MONGODB_ADMINUSERNAME: admin
      ME_CONFIG_MONGODB_ADMINPASSWORD: yourpassword
      ME_CONFIG_MONGODB_SERVER: mongo
    ports:
      - 8081:8081
    networks:
      - mongo-network

networks:
  mongo-network:
    driver: bridge

volumes:
  mongo-db:

and here is result of docker exec -it mongo-express env

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=1eb94c222db6
TERM=xterm
ME_CONFIG_MONGODB_ADMINPASSWORD=yourpassword
ME_CONFIG_MONGODB_SERVER=mongo
ME_CONFIG_MONGODB_ADMINUSERNAME=admin
NODE_VERSION=18.19.0
YARN_VERSION=1.22.19
ME_CONFIG_MONGODB_URL=mongodb://mongo:27017
ME_CONFIG_MONGODB_ENABLE_ADMIN=true
VCAP_APP_HOST=0.0.0.0
MONGO_EXPRESS_VERSION=1.0.0
HOME=/root

i anticipate the id/password is changed to admin/yourpassword but id/password is not changed. it stay at default id/password(admin/pass).

here is log of mongo-express

Welcome to mongo-express
------------------------


Mongo Express server listening at http://0.0.0.0:8081
Server is open to allow connections from anyone (0.0.0.0)
basicAuth credentials are "admin:pass", it is recommended you change this in your config.js!

why i can't change my id/password by using yaml file? could you give me the solution of it?

i try restart of docker but it was not help to solve problem

0

There are 0 best solutions below