mirror of
https://github.com/apple/container.git
synced 2026-10-19 04:29:17 +00:00
Add DNS aliases and subtree aliases for container network attachments (#2390)
- Closes #457. - A container can now declare additional DNS names for a network attachment with a repeatable `alias` property on `--network`, including subtree aliases that match every name below a domain. - With the default domain `test`, this container answers to `gateway.test` by its name, to `api.test` by the exact alias, and to `web.gateway.test`, `a.b.gateway.test` and every other name below `gateway.test` by the subtree alias. The motivating case is a gateway container in front of a local Kubernetes cluster that answers for `*.gateway.test`, with an ingress controller routing on the `Host` header. - An alias is an exact name, or a name with a leading dot that matches every name below it. A name without a dot gets the default domain, as container names do. A subtree alias must be below a name the same attachment owns, and exact names are unique across all containers, so a container cannot claim another container's namespace. The rules for one attachment are checked when a container is created, again when a stored container starts, and again by the network helper when it registers the aliases. See `docs/architecture/dns.md` for the design, the invariants and the security considerations.
This commit is contained in:
1 parent
17ea964c6c
commit
b3eb70307a
32 files changed
+2530
-63
No files matched your search
@@ -61,7 +61,7 @@ container run [<options>] <image> [<arguments> ...]
|
||||
* `--masked-path <path>`: **Experimental.** Hide a path inside the container, in addition to the runtime defaults (or `NONE` to clear prior values and the defaults)
|
||||
* `--mount <mount>`: Add a mount to the container (format: type=<>,source=<>,target=<>,readonly)
|
||||
* `--name <name>`: Use the specified name as the container ID
|
||||
* `--network <network>`: Attach the container to a network (format: `<name>[,mac=XX:XX:XX:XX:XX:XX][,mtu=VALUE]`)
|
||||
* `--network <network>`: Attach the container to a network (format: `<name>[,mac=XX:XX:XX:XX:XX:XX][,mtu=VALUE][,alias=NAME]...`). Use `alias` to give the container additional DNS names; see [Give a container additional DNS names](networking.md#give-a-container-additional-dns-names)
|
||||
* `--no-dns`: Do not configure DNS in the container
|
||||
* `--os <os>`: Set OS if image can target multiple operating systems (default: linux)
|
||||
* `-p, --publish <spec>`: Publish a port from container to host (format: [host-ip:]host-port:container-port[/protocol])
|
||||
@@ -105,6 +105,9 @@ container run -e NODE_ENV=production --cpus 2 --memory 1G node:18
|
||||
# run a container with a specific MAC address
|
||||
container run --network default,mac=02:42:ac:11:00:02 ubuntu:latest
|
||||
|
||||
# run a container that also answers to api.test and to every name below gateway.test
|
||||
container run --name gateway --network default,alias=api.test,alias=.gateway.test nginx:latest
|
||||
|
||||
# run a container with an init process to reap zombies and forward signals
|
||||
container run --init ubuntu:latest my-app
|
||||
|
||||
@@ -226,7 +229,7 @@ container create [<options>] <image> [<arguments> ...]
|
||||
* `--masked-path <path>`: **Experimental.** Hide a path inside the container, in addition to the runtime defaults (or `NONE` to clear prior values and the defaults)
|
||||
* `--mount <mount>`: Add a mount to the container (format: type=<>,source=<>,target=<>,readonly)
|
||||
* `--name <name>`: Use the specified name as the container ID
|
||||
* `--network <network>`: Attach the container to a network (format: `<name>[,mac=XX:XX:XX:XX:XX:XX][,mtu=VALUE]`)
|
||||
* `--network <network>`: Attach the container to a network (format: `<name>[,mac=XX:XX:XX:XX:XX:XX][,mtu=VALUE][,alias=NAME]...`). Use `alias` to give the container additional DNS names; see [Give a container additional DNS names](networking.md#give-a-container-additional-dns-names)
|
||||
* `--no-dns`: Do not configure DNS in the container
|
||||
* `--os <os>`: Set OS if image can target multiple operating systems (default: linux)
|
||||
* `-p, --publish <spec>`: Publish a port from container to host (format: [host-ip:]host-port:container-port[/protocol])
|
||||
|
||||
Reference in new issue
Block a user