Should I SSH into bare metal or a Docker container?

I've got multiple Docker containers running on a home server. If I want to just access a specific container, should I SSH into my server and then start/mess with my container or install an SSH server in my container and SSH into that?


Solution 1:

Containers are generally intended to be minimal environments, so they shouldn't each have an SSH daemon running.

The usual way to handle this is to just SSH into the Docker host and run

docker exec -it <container-name-or-id> /bin/sh

You can substitute /bin/sh with /bin/bash or whatever other shell that's available in your container.