Cant connect to docker container via SSH from another container

Hi,

I have two containers:

  • The first expose an ssh server on port 2222
  • The second have a ssh client

When I connect to the ssh server container from the host it works fine.
But when I try from the client container I get “Connection refused”.

Here is my ssh command:

ssh my_user@127.0.0.1 -p 2222

Do you have any idea ?

Many thanks for your help.