@@ -4,9 +4,9 @@ open inside the container in the `Client().create_container()` method.
4
4
Bindings are declared in the ` host_config ` parameter.
5
5
6
6
``` python
7
- container_id = c .create_container(
7
+ container_id = cli .create_container(
8
8
' busybox' , ' ls' , ports = [1111 , 2222 ],
9
- host_config = docker.utils .create_host_config(port_bindings = {
9
+ host_config = cli .create_host_config(port_bindings = {
10
10
1111 : 4567 ,
11
11
2222 : None
12
12
})
@@ -17,22 +17,22 @@ container_id = c.create_container(
17
17
You can limit the host address on which the port will be exposed like such:
18
18
19
19
``` python
20
- docker.utils .create_host_config(port_bindings = {1111 : (' 127.0.0.1' , 4567 )})
20
+ cli .create_host_config(port_bindings = {1111 : (' 127.0.0.1' , 4567 )})
21
21
```
22
22
23
23
Or without host port assignment:
24
24
25
25
``` python
26
- docker.utils .create_host_config(port_bindings = {1111 : (' 127.0.0.1' ,)})
26
+ cli .create_host_config(port_bindings = {1111 : (' 127.0.0.1' ,)})
27
27
```
28
28
29
29
If you wish to use UDP instead of TCP (default), you need to declare ports
30
30
as such in both the config and host config:
31
31
32
32
``` python
33
- container_id = c .create_container(
33
+ container_id = cli .create_container(
34
34
' busybox' , ' ls' , ports = [(1111 , ' udp' ), 2222 ],
35
- host_config = docker.utils .create_host_config(port_bindings = {
35
+ host_config = cli .create_host_config(port_bindings = {
36
36
' 1111/udp' : 4567 , 2222 : None
37
37
})
38
38
)
0 commit comments