Use IPv6 from host interface without network_mode: bridge and only publish port

Hi,

Is it possible to publish a port for an IPv6 address that lives on the host interface - like you have with IPv4 - using a bridge and not setting it in the docker-compose file ?

Thanks.

EDIT:

What do you mean by not setting it in compose file? The same method should ork on docker run as well


Original post:

Yes. The documentation shows some examples too
https://docs.docker.com/reference/compose-file/services/#ports

Quote:

IPv6 addresses can be enclosed in square brackets.

Examples:


ports:
  - "3000"
  - "3000-3005"
  - "8000:8000"
  - "9090-9091:8080-8081"
  - "49100:22"
  - "8000-9000:80"
  - "127.0.0.1:8001:8001"
  - "127.0.0.1:5000-5010:5000-5010"
  - "::1:6000:6000"
  - "[::1]:6001:6001"
  - "6060:6060/udp"