mirror of https://github.com/docker/compose.git
Merge pull request #3154 from aanand/move-ip-docs-to-reference
Move ipv4_address/ipv6_address docs to reference section
This commit is contained in:
commit
b2b58402b3
|
@ -545,6 +545,38 @@ In the example below, three services are provided (`web`, `worker`, and `db`), a
|
||||||
new:
|
new:
|
||||||
legacy:
|
legacy:
|
||||||
|
|
||||||
|
#### ipv4_address, ipv6_address
|
||||||
|
|
||||||
|
Specify a static IP address for containers for this service when joining the network.
|
||||||
|
|
||||||
|
The corresponding network configuration in the [top-level networks section](#network-configuration-reference) must have an `ipam` block with subnet and gateway configurations covering each static address. If IPv6 addressing is desired, the `com.docker.network.enable_ipv6` driver option must be set to `true`.
|
||||||
|
|
||||||
|
An example:
|
||||||
|
|
||||||
|
version: '2'
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: busybox
|
||||||
|
command: ifconfig
|
||||||
|
networks:
|
||||||
|
app_net:
|
||||||
|
ipv4_address: 172.16.238.10
|
||||||
|
ipv6_address: 2001:3984:3989::10
|
||||||
|
|
||||||
|
networks:
|
||||||
|
app_net:
|
||||||
|
driver: bridge
|
||||||
|
driver_opts:
|
||||||
|
com.docker.network.enable_ipv6: "true"
|
||||||
|
ipam:
|
||||||
|
driver: default
|
||||||
|
config:
|
||||||
|
- subnet: 172.16.238.0/24
|
||||||
|
gateway: 172.16.238.1
|
||||||
|
- subnet: 2001:3984:3989::/64
|
||||||
|
gateway: 2001:3984:3989::1
|
||||||
|
|
||||||
### pid
|
### pid
|
||||||
|
|
||||||
pid: "host"
|
pid: "host"
|
||||||
|
|
|
@ -116,29 +116,7 @@ Here's an example Compose file defining two custom networks. The `proxy` service
|
||||||
foo: "1"
|
foo: "1"
|
||||||
bar: "2"
|
bar: "2"
|
||||||
|
|
||||||
Networks can be configured with static IP addresses by setting the ipv4_address and/or ipv6_address for each attached network. The corresponding `network` section must have an `ipam` config entry with subnet and gateway configurations for each static address. If IPv6 addressing is desired, the `com.docker.network.enable_ipv6` driver option must be set to `true`. An example:
|
Networks can be configured with static IP addresses by setting the [ipv4_address and/or ipv6_address](compose-file.md#ipv4-address-ipv6-address) for each attached network.
|
||||||
|
|
||||||
version: '2'
|
|
||||||
|
|
||||||
services:
|
|
||||||
app:
|
|
||||||
networks:
|
|
||||||
app_net:
|
|
||||||
ipv4_address: 172.16.238.10
|
|
||||||
ipv6_address: 2001:3984:3989::10
|
|
||||||
|
|
||||||
networks:
|
|
||||||
app_net:
|
|
||||||
driver: bridge
|
|
||||||
driver_opts:
|
|
||||||
com.docker.network.enable_ipv6: "true"
|
|
||||||
ipam:
|
|
||||||
driver: default
|
|
||||||
config:
|
|
||||||
- subnet: 172.16.238.0/24
|
|
||||||
gateway: 172.16.238.1
|
|
||||||
- subnet: 2001:3984:3989::/64
|
|
||||||
gateway: 2001:3984:3989::1
|
|
||||||
|
|
||||||
For full details of the network configuration options available, see the following references:
|
For full details of the network configuration options available, see the following references:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue