Я нашел решение.
Но я не знаю, почему это (Docker assign different Range of IP address to all containers)
произошло.
когда мы создаем контейнер Docker, он создает новую сеть projectName_default
.
В этой сети определены такие данные:
ubuntu@pro_staging:~> sudo docker network ls
NETWORK ID NAME DRIVER SCOPE
fb1861a4afc0 projecName_default bridge local
e60b761f9aa9 bridge bridge local
0ab8ff5w5f2d host host local
a4e689dc9dcb none null local
ubuntu@pro_staging:~> sudo docker inspect projecName_default
[
{
"Name": "projecName_default",
"Id": "fb1861a4ac4059f6abea25b49c331390d651fdsdde24e15a848507723c2e4cd4f",
"Created": "2018-11-02T11:15:37.136315048Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.20.0.0/16",
"Gateway": "172.20.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"87855a403d18df21910d6fd6d0132328d09a954800200e46ad35fa325fb42897f": {
"Name": "projecName_default_containr1",
"EndpointID": "a55d85fb759d997957fdd15eddba28e1598176d7c5bdb9e2d42fd1967f7f763b",
"MacAddress": "02:42:ac:14:00:03",
"IPv4Address": "172.20.0.3/16",
"IPv6Address": ""
},
"9b0d45d8310e9877de147b89dd74c7dfb2d55a1660c7ab664f3e831d100eee0f": {
"Name": "projecName_default_containr_2",
"EndpointID": "68ba68e2c4bb3a7a8861b1fa2d43edecbfc0d29586c8169361bb47e94c37d460",
"MacAddress": "02:42:ac:14:00:04",
"IPv4Address": "172.20.0.4/16",
"IPv6Address": ""
},
"edf3bf11199dba6b7ada6105773341baca4790ff713d40988ffbe54cd73a638d": {
"Name": "projecName_default_containr_3",
"EndpointID": "62d17e5b7f1909d60aa4c79fccb276f5a50f84d79b9da8d6f6bf5c7f54cb313f",
"MacAddress": "02:42:ac:14:00:02",
"IPv4Address": "172.20.0.2/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {}
}
]
Исправление:
# Remove default network
ubuntu@pro_staging:~> sudo docker network rm projecName_default
#Restart docker
ubuntu@pro_staging:~> sudo systemctl restart docker
#After restart docker create container again.