I want to manage the docker service automating. And I must bind a port to the service. But the docker service creating function in the docker SDK for python cannot bind a port. https://docker-py.readthedocs.io/en/stable/services.html Is there any method to figure out this problem?
Asked
Active
Viewed 515 times
1 Answers
0
Try the below code:
port_bindings={1111: [5033, 5035]}
host_config = client.create_host_config(
port_bindings = port_bindings
)
container = client.create_container(
image='josepainumkal/vwadaptor:jose_toolUI',
host_config=host_config
)
client.start(container=container.get('Id'))

josepainumkal
- 1,613
- 1
- 16
- 23