title: How do I ssh from one docker container to another docker container?
body: <p>Here is the scenario.</p>
  
  <p>I have three containers.</p>
  
  <p>Container1, container2, and container3 (Ubuntu based image) where the container2 acts as a router between container 1 and container2.</p>
  
  <p>I will run a server program in container3 which runs indefinitely but when I initiate the connection from the client,I will collect some statistics, for the next run, I need to change some parameters in the server (using tc netem) and re run the test.</p>
  
  <p>I need to SSH and execute a command in Middlerouter as well as in container3 before I go to next run.</p>
  
  <p>I cannot login with SSH because it says connection refused. I have a port 22 exposed to all the containers</p>
  
  <p>Here is the image of containers running
  <a href="https://i.stack.imgur.com/rhoPA.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/rhoPA.jpg" alt="enter image description here"></a></p>