localhost : ERROR: ssh: connect to host localhost port 22: Address not available

Newbie to docker, trying to set up Hadoop container for which I first create ssh-server container for easy debug as my first container is working fine am able to login

ssh localhost

within the container without any password.

ssh-container:

docker build -t ssh-local .
docker run -d ssh-local

build success !!.

Hadoop-container:

when I run my second Hadoop container it says

ERROR: ssh: connect to host localhost port 22: Address not available

Please find all the relevant files in the repository itself.
https://github.com/nitesh-kumar-sharma/hands-dirty-docker/blob/master/

Any errors from the container? how did you start it? please provide compose file or your docker run command

docker build -t local-ssh . (for first container)
docker run -d local-ssh
docker exec -it local-ssh bash
#bash ssh localhost (woking fine)

For second container
docker build -t local-hadoop .
docker run -it local-hadoop
(will give you error)