Docker Community Forums

Share and learn in the Docker community.

How does docker assign container IP addresses


(Tnegeli) #1

I’m on the latest version of Docker for Mac 18.03.1-ce-mac65 (24312) and really have a strange problem.

I boot up a specific project and its containers get assigned a private IP and gateway address. For example:

“Networks”: {
“projectname_default”: {
“IPAMConfig”: null,
“Links”: [
“projectname_mysql_1:mysql”,
“projectname_mysql_1:mysql_1”,
“projectname_mysql_1:projectname_mysql_1”
],
“Aliases”: [
“php”,
“8cbf53188be1”
],
“NetworkID”: “8a57c92c09250d1634caace8389dc5c98649fdad836de5bbb42661548bd22825”,
“EndpointID”: “3a9c206fb3950b2ec4f33dd96c566c9833106d82de5fb8e749e615bbc0e2c37e”,
“Gateway”: “192.168.16.1”,
“IPAddress”: “192.168.16.6”,
“IPPrefixLen”: 20,
“IPv6Gateway”: “”,
“GlobalIPv6Address”: “”,
“GlobalIPv6PrefixLen”: 0,
“MacAddress”: “02:42:c0:a8:10:06”,
“DriverOpts”: null
}
}

This results is the fact that I can only reach external addresses, and addresses of our internal company network are unreachable.
If I boot up the same project on a different machine (Same project, same docker version, same OS 10.13.6) it gets assigned a 172.* IP.
Also other projects on the same machine work as expected and do not have this problem.

So my question is, by which rule does docker assign the container IPs and Gateway addresses, and how can I influence this behaviour. Or maybe I have done something that influences this specific project.

Thanky in advance for any help.


(Tnegeli) #2

A reset to Docker factory defaults solved the problem.
This is not a good solution, because I did not find out what the problem was, but temporary helped out.