Unable to connect to mongodb running in a docker container

Viewed 17
mongo:
    image: mongo
    environment:
      - MONGO_INITDB_ROOT_USERNAME=hkeremk
      - MONGO_INITDB_ROOT_PASSWORD=abcd

I wrote this command to reach mongodb on my docker container, so I created container but unable connect with it.

When I wrote this :

docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d --build

then, check with "docker ps" I get this

42ff3abe68f2   mongo                  "docker-entrypoint.s…"   11 minutes ago   Up 11 minutes   27017/tcp                node_docker_mongo_1

Its okay but when I try to reach that I get this;

Node_Docker % docker exec -it node_docker_mongo_1 bash 
root@42ff3abe68f2:/# mongo -u "hkeremk" -p "abcd"
bash: mongo: command not found

How can I fix this error?

0 Answers
Related