Docker Community Forums

Share and learn in the Docker community.

Unable to Create docker container on overlay network using static ip

docker

(Nitishmowall) #1

Previous using Docker 17.05, I was able to create overlay network with subnet 10.0.7.0/24 and then I was able to create a container with IP 10.0.7.2.

Now I am using Docker 18.03, I am able to create overlay network with subnet 10.0.7.0/24. But I am not able to create a container with IP 10.0.7.2. I know that 10.0.7.1 is gateway IP. But what is 10.0.7.2 is being used for in new Docker(18.03).

please, can anybody explain why this happening?

On Docker 18.03, mynet is my overlay network

$ docker inspect mynet
[
{
“Name”: “mynet”,
“Id”: “4lq0j7thvyb8dkwt0zbbvgski”,
“Created”: “2018-03-29T09:27:41.369349452Z”,
“Scope”: “swarm”,
“Driver”: “overlay”,
“EnableIPv6”: false,
“IPAM”: {
“Driver”: “default”,
“Options”: null,
“Config”: [
{
“Subnet”: “10.0.7.0/24”,
“Gateway”: “10.0.7.1”
}
]
},
“Internal”: false,
“Attachable”: true,
“Ingress”: false,
“ConfigFrom”: {
“Network”: “”
},
“ConfigOnly”: false,
“Containers”: null,
“Options”: {
“com.docker.network.driver.overlay.vxlanid_list”: “4102”
},
“Labels”: null
}
]

docker run is showing this error:

$ docker run -dit --name mycon --network mynet --ip 10.0.7.2 ubuntu:16.04
caebeda51357d8e53f11fb765c8b4a65bd6c37d6746dbbdd1b4b8be7e6235a44
docker: Error response from daemon: attaching to network failed, make sure your network options are correct and check manager logs: context deadline exceeded.

Thanks in advance.