Docker Community Forums

Share and learn in the Docker community.

Ssh and docker exec takes me to different host (different container ids)

Hi,

After upgrading docker to docker-ce(18.09) we are witnessing a weird behaviour where if I do ssh into the host with the ‘HostPort’ of the container lands in different container when compared to doing docker exec into that container.
------------------------------SSH-------------------------------------------------------------Actual ContainerIDs
ssh host-ip -p HostPortOfContainer1 —> [root@67aa8c2ee7ad ~]# ----------67aa8c2ee7ad
ssh host-ip -p HostPortOfContainer2 —> [root@e05d52518f39 ~]# -----------e05d52518f39
ssh host-ip -p HostPortOfContainer3 —> [root@2db36482e5e2 ~]# ----------0fbda56fde9b
ssh host-ip -p HostPortOfContainer4 —> [root@10c26aeac1ef ~]# -----------10c26aeac1ef
ssh host-ip -p HostPortOfContainer5 —> [root@5885b8db6678 ~]# ----------e0d69c82a144

As you can see, container 3 and 5 have mismatch between containerID and hostname it ends up when i do ssh directly into container.

I can find the ‘5885b8db6678’ and ‘2db36482e5e2’ in /var/lib/docker/containers though. but those containers are not there now. I cannot docker inspect or docker exec these, but when i ssh using hostport i end up in them. So why are they still listening on hostport?

PS: This problem was not their in my older version of docker, i see this only in my newer verison(18.09)

Thanks,