Open gururajsrk opened 5 years ago
You can either:
Number 2 will obviously cause a short network blip. To do number 1, you'll have to circumvent the high-level implementation which currently doesn't give you that flexibility (it's something we need to fix).
nconf = self.client.api.create_networking_config({
'radio': self.client.api.create_endpoint_config(
ipv4_address='172.21.0.21',
)
})
container_id = self.client.api.create_container(
self.cimagename, detach=True, networking_config=nconf,
**self.client.containers._create_container_args(argd)
)
container = self.client.containers.get(container_id)
# no need to call network.connect anymore
Check out the APIClient.create_container
docs for more info.
Hi,
**self.client.containers._create_container_args(argd) is failing with AttributeError: 'ContainerCollection' object has no attribute '_create_container_args'
Any how network.disconnect() method worked. After this I am able to call connect() and it worked.
My bad, it isn't actually a method of client.containers
, but a function in docker.models.containers
.
Hi,
I have issue and could not find solution regarding this Use case: Trying to assign a static ip from a network to a container and same ip has to be used for portmapping to host network I am able to achieve this from binary but not from docker.py library
in code I am creating container
Even though i have provided a static ip, it wont use this static called using connect(). It only assigns random ip provided from network radio pool. Can someone help me on this