compose-spec icon indicating copy to clipboard operation
compose-spec copied to clipboard

Document IPv6 port mapping

Open ndeloof opened this issue 4 years ago • 1 comments

What is the problem you're trying to solve docker-compose used to accept x:y:y:host-port:published-port syntax for port mapping with ipV6 addresses. It's legitimate to support this for backward compatibility, but still this syntax is incorrect according to IETF: https://tools.ietf.org/html/rfc3986

Describe the solution you'd like compose-spec SHOULD include ipv6 examples to clarify the expected syntax and recommend use of square brackets.

Additional context https://github.com/docker/go-connections/pull/78 https://github.com/docker/docker-py/pull/2784

ndeloof avatar Mar 15 '21 10:03 ndeloof

Thanks!

To clarify; there are some (in hindsight) badly chosen formats in docker (and -compose) that use : as separator; this worked at the time (only IPv4 support), but is problematic when dealing with IPv6 IP literals, for example the "port-spec" format;

<hostname|interface|IP>:[<host-port|port-range>]:<container-port|port-range>[/<proto>]

Is ambiguous when using an IPv6 address (e.g. ::) for the equivalent to 0.0.0.0:80:80, this would become;

:::80:80

# or, without host-port (to assign a port in the ephemeral port-range)
::::80

While this is not strictly a URL, the same rules should be applied, and IPv6 addresses should be surrounded by square brackets;

[::]:80:80

[::]::80

thaJeztah avatar Mar 15 '21 10:03 thaJeztah