How to setup SSH access to a docker container?

I am running a docker container within an EC2 instance, How to ssh into the docker container directly without having to login to the container host i.e the EC2 instance here everytime?

  • How to access ports in docker custom bridge networks
  • Which DSpace Docker container is officially endorsed by the DSpace community?
  • Is it safe to use same host volume in multiple containers?
  • Docker API: cpu_stats vs percpu_stats
  • Reset Docker Machine to run Docker commands on my local machine
  • mysql docker container crashes often
  • How to Use Docker (or alternative) as Test Environment
  • permission denied error in docker
  • is there a way to do bind particular port on host to container port using docker file
  • Connect to redis inside bridge network
  • AWS Server setup with JIRA, Docker
  • Controlling the Data of a Database Docker Container
  • One Solution collect form web for “How to setup SSH access to a docker container?”

    There an example of setting up SSH service on the docker documentation.

    https://docs.docker.com/examples/running_ssh_service/

    Once you have the IP of the host and the port mapped to port 22 of the container, you should be able to ssh

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.