blob: 5a14d38d766ddf500f236a95027b97ee577d6657 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# Using Networks
With the release of Docker 1.9 you can now manage custom networks.
Here you can see how to create a network named ```network1``` using the ```bridge``` driver
```python
docker_client.create_network("network1", driver="bridge")
```
You can also create more advanced networks with custom IPAM configurations. For example,
setting the subnet to ```192.168.52.0/24``` and gateway to ```192.168.52.254```
```python
ipam_config = docker.utils.create_ipam_config(subnet='192.168.52.0/24', gateway='192.168.52.254')
docker_client.create_network("network1", driver="bridge", ipam=ipam_config)
```
With Docker 1.10 you can now also create internal networks
```python
docker_client.create_network("network1", driver="bridge", internal=True)
```
|