Open thaJeztah opened 7 years ago
👍 on the idea.
The discussion on task specific options and templating to go with it requires more discussions. There are cases where even such an option may be limiting especially when the task specific option is completely localized to the node where it is being scheduled.
So, in order to keep this proposal manageable , let us try and address the existing limitation and options and accomodate it with the new CSV format.
LGTM
@thaJeztah The proposal looks good.
A few things to watch out for:
:+1: :+1: :+1: :guitar:
I would love to see the container-alias
option, especially together with swarm/stacks. My understanding is that the only DNS name available right now is the service name itself. Also, being able to assign multiple aliases would be awesome, for instance to allow accessing a service on a specific node:
container-alias={{.Slot}}.{{.Service}}.{{.Node}}
container-alias={{.Service}}.{{.Node}}
Any chance of this happening?
Edit: I guess there's more than one DNS name, for stacks we have {name}
, {stack}_{name}
and {stack}_{name}.{slot}.{task}
. Are there any other? Also, where are these documented?
I would really like to see container-alias
with templating support.
Yes, https://github.com/moby/moby/pull/33130 / https://github.com/docker/cli/pull/62 adds initial options for services; https://github.com/docker/cli/pull/843 is addressing the missing documentation
CLI implementation for docker run
/ docker create
is worked on in https://github.com/docker/cli/pull/317
docker run
anddocker service create
currently don't support adding a container or service to multiple networks. The reason for this is that there is a number of options that can be set per network (for example, network-scoped aliases through--network-alias
, a fixed IP-address on a network through--ip
/--ip6
).The current situation severely limits networking options for services, as it's currently not possible to;
docker service update
) after a service is createddocker stack deploy
)The advanced "csv" syntax (as is used for
docker service create --mount
) solves this limitation by grouping options in a single flag, allowing options to be set per mount. The same can be done for networks.Proposed change
I want to propose adding the same syntax to
--network
and solve this limitation. The advanced syntax should support all network-related options that can be set currently ondocker run
anddocker network connect
, for example;Suggested options;
name
string
--network
alias
string[]
--network-alias
ip
string
--ip
ip6
string
--ip6
link
string
--link
link-local-ip
string[]
--link-local-ip
In addition, advanced networking options (as are proposed in https://github.com/docker/docker/pull/27638) can be passed, for example;
ipam-opt
(options for the IPAM plugin/driver)opt
(driver-specific options for the network)Possibly this would also allow options, such as bandwidth limitation per-network for a container/service (see https://github.com/docker/docker/pull/20794, https://github.com/docker/docker/issues/27809, https://github.com/docker/docker/issues/26767, https://github.com/docker/docker/pull/27846)
To be discussed - per-task/container options
For services, some options can be ambiguous, for example, an alias, or IP-address can apply to a service as a whole, or per task / container. Some thoughts if we want options to be applied to individual tasks;
container-ip
,container-alias
)container-alias={{.Service}}.{{.Slot}}.foobar
)container-ip=172.30.100.x
) - haven't given this one much thought, perhaps that's an IPAM option.To be discussed - auto-creation
Do we want the
--network
flag to create networks if they don't exist, or keep the current behavior, and require the network to be created up front?Personally, I think requiring a network to exist is a cleaner approach (better separation of concerns).
Related issues;
service create
/service update
(https://github.com/docker/docker/issues/25303)--network-alias
option missing on docker service create https://github.com/docker/docker/issues/24787docker run
(https://github.com/docker/docker/issues/17750, https://github.com/docker/docker/issues/17289, https://github.com/docker/docker/pull/17796)ping @docker/core-engine-maintainers @docker/core-libnetwork-maintainers