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?

  • UnknownHostException only on Bluemix
  • Docker Compose does not bind ports
  • Gitlab docker not working if external_url is set
  • Docker Volume Access Error
  • Django show “It worked” page instead of my project when I start it docker
  • debugging nodejs docker image inside vagrant
  • Linking exposed port of docker with with the default nginx port
  • Not dockerized nginx load balancing to gitlab dockerized
  • How to convert a Vagrantfile to a Dockerfile
  • How to link docker containers on build?
  • Docker application support in Hadoop YARN
  • How to configure the publish address of elasticsearch 5.0 with CLI flags?
  • 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.

    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.