Document address_mode

This commit is contained in:
Michael Schurter
2017-06-19 17:17:40 -07:00
parent 57b6f6ec51
commit ee5e02fa3c
2 changed files with 29 additions and 2 deletions

View File

@@ -355,7 +355,7 @@ container.
These ports will be identified via environment variables. For example:
```
```hcl
port "http" {}
```
@@ -401,6 +401,25 @@ Note that by default this only works with `bridged` networking mode. It may
also work with custom networking plugins which implement the same API for
expose and port forwarding.
### Using Docker IPs and Ports
*New in Nomad 0.6.*
Other than `host` and `none`, Docker network modes create an IP for the
container. This IP is set when the container is run and exposed as a
`NOMAD_DRIVER_IP_<label>` environment variable for use in script checks.
The ports specified in the `port_map` are exposed via the
`NOMAD_DRIVER_PORT_<label>` environment variables. Unlike the IP, ports are
available *when* the container is run and can be used in `args` or as
environment variables within the container.
When using network plugins like `weave` that assign containers a routable IP
address, that address will automatically be used in any `service`
advertisements for the task. You may override what address is advertised by
using the `address_mode` parameter on a `service`. See
[service](/docs/job-specification/service.html) for details.
### Networking Protocols
The Docker driver configures ports on both the `tcp` and `udp` protocols.

View File

@@ -93,6 +93,14 @@ does not automatically enable service discovery.
this service. If this is not supplied, no tags will be assigned to the service
when it is registered.
- `address_mode` `(string: "auto")` - Specifies what address (host or
driver-specific) this service should advertise. `host` indicates the host IP
and port. `driver` advertises the IP used in the driver (eg Docker's internal
IP) and uses the ports specifid in the port map. The default is `auto` which
behaves the same as `host` unless the driver determines its IP should be used.
This setting was added in Nomad 0.6 and only supported by the Docker driver.
It will advertise the container IP if a network plugin is used (eg weave).
### `check` Parameters
- `args` `(array<string>: [])` - Specifies additional arguments to the
@@ -131,7 +139,7 @@ does not automatically enable service discovery.
stanza. If a port value was declared on the `service`, this will inherit from
that value if not supplied. If supplied, this value takes precedence over the
`service.port` value. This is useful for services which operate on multiple
ports.
ports. Checks will *always use the host IP and ports*.
- `protocol` `(string: "http")` - Specifies the protocol for the http-based
health checks. Valid options are `http` and `https`.