SSH to Docker Container

Check first the names of your container:

1docker ps

Technically though, it's just running a shell, so run as follows:

1docker exec -it <container-name> /bin/bash

In case you see this error:

1OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown

You can probe a little and check any available shell. Run:

1docker exec -it <container-name> ls -l /bin/

You may recognize a few shell like:

  • /bin/ash
  • /bin/sh

So use those.

Some helpful details https://phase2.github.io/devtools/common-tasks/ssh-into-a-container/