how to ssh docker container

The image you're using seems that it doesn't have the binary /bin/bash installed but it should have /bin/sh

Try:

docker exec -it cc55da85b915 sh

You might need to specify the full path to bash, e.g.:

docker exec -it cc55da85b915 /bin/bash

or /usr/local/bin/bash, or wherever bash is located in that image.

Hope this helps!


It could be your image does not have the binary /bin/bash installed (as suggested before), I had the same problem and I was able to enter into the container using /bin/sh

docker exec -ti cc55da85b915 /bin/sh

Another workaround could be execute directly the commands without get access to any shell.

docker exec -ti cc55da85b915 ls /etc

You have many different ways to do that, you can attach using docker's attach command.

$ sudo docker attach cc55da85b915 #by ID

Or you can use docker exec command:

$ sudo docker exec -i -t cc55da85b915 /bin/bash

If /bin/bash fails, you can use /bin/sh that works in more containers:

$ sudo docker exec -i -t cc55da85b915 /bin/sh

Tags:

Docker

Ssh