0

I have docker Docker version 1.10.3, build 20f81dd and a client docker-py==1.9.0. I want to be able to set --net=host (docker) or net: host (docker-compose) setting via python client, but the docs say network_mode is available since v1.11.

How can I emulate this behaviour via python client?

Most Wanted
  • 6,254
  • 5
  • 53
  • 70

2 Answers2

0

I see in the docs

https://docker-py.readthedocs.io/en/stable/containers.html#container-objects

among other things

host - > Use the host network stack.

user2915097
  • 30,758
  • 6
  • 57
  • 59
0

I Used something like this in my code.

container = client.containers.run("<imagename>", name = "sample", network_mode = "host")