Got same IP for 2 containers

Expected behavior

Ideally IP per container must be different

Actual behavior

Am getting same IP for 2 containers. And one of the container ID being displayed in ping does not event exists.

Additional Information

Docker version : Docker version 18.03.0-ce, build 0520e24

Steps to reproduce the behavior

Unable to reproduce the issue everytime. But as this is on PRODUCTION env. we need to provide some answer & solution.

Looks like some collision. Does ip address based on container name?
I have removed ( docker rm -f con1 ) one of those containers, then started another container with the same name ( docker run --rm -it --name con1 ubuntu sleep 100 ) and it got address.

with regards

UC Browser SHAREit MX Player

Am not assigning any IP to container. It’s managed by docker swarm.
I removed the container even from dead container list but still others containers are referring to dead container.

There is some issue with docker network.

Docker swarm is in general a problem, since the IP assignment depends on the way you configure the network. It can easily happen, that two container on different hosts get the same IP.

Look for IPAM for detailed information about the potential pitfalls