How to SSH into a Docker container

Click for: original source

How do you use SSH to enter a Docker container? The traditional approach consists of two step. By Debdut Chakraborty.

With some efforts, you can actually SSH into a running container directly, without logging into the host system first. The article then guides you how to:

  • SSH into a Docker container: But why?
  • Setting up SSH access for Docker containers
  • Set up the SSH daemon in the container
  • Log into the container via SSH
  • How does this work?
  • Deploy the service

The article then explains how to use the _docker compose and reproducible, configurable way of deploying an SSH server container on your remote host. Since you will be accessing the server via SSH keys, you need to add the public SSH key of your local system to your host Linux server’s directory where docker-compose file is located and keep the name “id_rsa.pub” just to be sure. Good read!

[Read More]

Tags containers docker devops infosec how-to