- Show how to pass the networking config in POST containers/create body
Signed-off-by: Alessandro Boch <aboch@docker.com>
(cherry picked from commit 30859c34569b900d3d798ad55f48f3d4fd7dc32c)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -298,6 +298,17 @@ Create a container |
| 298 | 298 |
"CgroupParent": "", |
| 299 | 299 |
"VolumeDriver": "", |
| 300 | 300 |
"ShmSize": 67108864 |
| 301 |
+ }, |
|
| 302 |
+ "NetworkingConfig": {
|
|
| 303 |
+ "EndpointsConfig": {
|
|
| 304 |
+ "isolated_nw" : {
|
|
| 305 |
+ "IPAMConfig": {
|
|
| 306 |
+ "IPv4Address":"172.20.30.33", |
|
| 307 |
+ "IPv6Address":"2001:db8:abcd::3033" |
|
| 308 |
+ }, |
|
| 309 |
+ "Links":["container_1", "container_2"], |
|
| 310 |
+ "Aliases":["server_x", "server_y"] |
|
| 311 |
+ } |
|
| 301 | 312 |
} |
| 302 | 313 |
} |
| 303 | 314 |
|
| ... | ... |
@@ -2952,11 +2963,17 @@ Content-Type: application/json |
| 2952 | 2952 |
"Name":"isolated_nw", |
| 2953 | 2953 |
"Driver":"bridge", |
| 2954 | 2954 |
"IPAM":{
|
| 2955 |
- "Config":[{
|
|
| 2956 |
- "Subnet":"172.20.0.0/16", |
|
| 2957 |
- "IPRange":"172.20.10.0/24", |
|
| 2958 |
- "Gateway":"172.20.10.11" |
|
| 2959 |
- }], |
|
| 2955 |
+ "Config":[ |
|
| 2956 |
+ {
|
|
| 2957 |
+ "Subnet":"172.20.0.0/16", |
|
| 2958 |
+ "IPRange":"172.20.10.0/24", |
|
| 2959 |
+ "Gateway":"172.20.10.11" |
|
| 2960 |
+ }, |
|
| 2961 |
+ {
|
|
| 2962 |
+ "Subnet":"2001:db8:abcd::/64", |
|
| 2963 |
+ "Gateway":"2001:db8:abcd::1011" |
|
| 2964 |
+ } |
|
| 2965 |
+ ], |
|
| 2960 | 2966 |
"Options": {
|
| 2961 | 2967 |
"foo": "bar" |
| 2962 | 2968 |
} |
| ... | ... |
@@ -317,6 +317,17 @@ Create a container |
| 317 | 317 |
"CgroupParent": "", |
| 318 | 318 |
"VolumeDriver": "", |
| 319 | 319 |
"ShmSize": 67108864 |
| 320 |
+ }, |
|
| 321 |
+ "NetworkingConfig": {
|
|
| 322 |
+ "EndpointsConfig": {
|
|
| 323 |
+ "isolated_nw" : {
|
|
| 324 |
+ "IPAMConfig": {
|
|
| 325 |
+ "IPv4Address":"172.20.30.33", |
|
| 326 |
+ "IPv6Address":"2001:db8:abcd::3033" |
|
| 327 |
+ }, |
|
| 328 |
+ "Links":["container_1", "container_2"], |
|
| 329 |
+ "Aliases":["server_x", "server_y"] |
|
| 330 |
+ } |
|
| 320 | 331 |
} |
| 321 | 332 |
} |
| 322 | 333 |
|
| ... | ... |
@@ -3002,13 +3013,19 @@ Content-Type: application/json |
| 3002 | 3002 |
{
|
| 3003 | 3003 |
"Name":"isolated_nw", |
| 3004 | 3004 |
"Driver":"bridge", |
| 3005 |
- "EnableIPv6": false, |
|
| 3005 |
+ "EnableIPv6": true, |
|
| 3006 | 3006 |
"IPAM":{
|
| 3007 |
- "Config":[{
|
|
| 3008 |
- "Subnet":"172.20.0.0/16", |
|
| 3009 |
- "IPRange":"172.20.10.0/24", |
|
| 3010 |
- "Gateway":"172.20.10.11" |
|
| 3011 |
- }], |
|
| 3007 |
+ "Config":[ |
|
| 3008 |
+ {
|
|
| 3009 |
+ "Subnet":"172.20.0.0/16", |
|
| 3010 |
+ "IPRange":"172.20.10.0/24", |
|
| 3011 |
+ "Gateway":"172.20.10.11" |
|
| 3012 |
+ }, |
|
| 3013 |
+ {
|
|
| 3014 |
+ "Subnet":"2001:db8:abcd::/64", |
|
| 3015 |
+ "Gateway":"2001:db8:abcd::1011" |
|
| 3016 |
+ } |
|
| 3017 |
+ ], |
|
| 3012 | 3018 |
"Options": {
|
| 3013 | 3019 |
"foo": "bar" |
| 3014 | 3020 |
} |
| ... | ... |
@@ -59,6 +59,8 @@ could be added: |
| 59 | 59 |
$ iptables -I DOCKER -i ext_if ! -s 8.8.8.8 -j DROP |
| 60 | 60 |
``` |
| 61 | 61 |
|
| 62 |
+where *ext_if* is the name of the interface providing external connectivity to the host. |
|
| 63 |
+ |
|
| 62 | 64 |
## Communication between containers |
| 63 | 65 |
|
| 64 | 66 |
Whether two containers can communicate is governed, at the operating system level, by two factors. |