0

I am trying to run my node.js app and mongodb using docker compose. I could setup the containers successfully as follows. The site is also working. But I could not login into the containers.

docker ps -a

Output

CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                                                            NAMES
68582ac4aa9a        projet/nodeserver      "/bin/bash -c 'sourc…"   2 hours ago         Up 2 hours          0.0.0.0:8080->8080/tcp                                           apiserver
81b6c0c65e43        mongo                  "docker-entrypoint.s…"   2 hours ago         Up 2 hours          0.0.0.0:27017->27017/tcp                                         mongodb

Also I am able to connect with mongodb server using mongodb client from the host machine(Mac). But when I tried to login to mongodb container, it throws following error.

Ssh into mongo docker

docker exec -it mongodb /bin/bash

Error

connection error: desc = "transport: dial unix /var/run/docker/containerd/docker-containerd.sock: connect: connection refused": unknown

What does it mean? How can I fix it?

1 Answers1

0

Do you try to connect it using container ID ?

Try this:

docker exec -it 81b6c0c65e43 bash

if isn't working try to restart container as follow:

docker restart 81b6c0c65e43