Typically, when we launch a container, the Docker Engine assigns an IP address to that container. Of course, we can use the host network mode to attach the container to the Docker host's IP address, or use the none network mode to launch a container without any IP address assigned to it. However, you might come across scenarios wherein multiple services have to share the same IP address. In such situations, you can run multiple services inside a container; however, such a practice is deemed as anticontainer-pattern.
The better alternative is to run each service inside separate containers, but share the IP address, as shown in the following topology:
In essence, the Docker Engine assigns an IP address for the IP container and then the IP address is inherited by the Service1, Service2, and Service3 containers. In this recipe, we...