Run local docker container that can be SSHed into

I”m trying to test some changes to a Capastrano application. I was hoping to run a docker container locally that my application can SSH into, so I can run commands against the container and observe what happens.

I was looking at https://hub.docker.com/r/rastasheep/ubuntu-sshd/. I can ssh into via ssh [email protected] -p 49154, but I need to be able to access via it’s IP and port 22, e.g. ssh [email protected] but this will time out.

I suspect I need to do some docker network type stuff to get this working. Any ideas?

Source: StackOverflow