Is there any way to assign the static public IP to the container. So the container has the public IP. Client can access to container with the IP.
Since this question pops up on popular searches (docker assign ip container etc), the (currently) accepted answer is obsolete, and the correct one of @VonC is somewhat inconclusive (including discussion) let us summarize with an example of how it can be done and what the result is:
docker run -d nginx:latest #--> container with id be46...
docker network create --subnet 10.30.0.0/24 --ip-range 10.30.0.0/24 multi-host-network
docker network connect --ip 10.30.0.4 multi-host-network be46
now the container has 10.30.0.4/24 attached; you can ping 10.30.0.4 from the host on which the commands were run. After docker stop be46 ping's don't work anymore, and after you docker start be46 pings succeed again. On the host, the following route is created:
10.30.0.0/24 dev br-b74e7b452f23 proto kernel scope link src 10.30.0.1
(so the host assumes 10.30.0.1).
Note: this completes the task of "assigning given IP to a container", but it is unclear to me for now if you could do that in the "docker swarm" context, and achieve the same level of redundancy we have there (with the assignment of ports to services).