File: compose/networking.md, CC @gbarr01
The documentation under "Use a pre-existing network" is outdated ("external.name" is no longer used).
By the way: I'm looking for ways to deploy my stack on (indeed) a pre-existing network, but I just can't get it to work. The following Compose.yaml fragment does cause a separate network to be created ("MyApp_default") instead of using the "intranet" network that already existed.
networks:
default:
external: true
name: intranet
If you could add documentation on what I'm doing wrong, it'd be very much appreciated.
@shin- , my understanding is that "external" is _not_ outdated. Can you confirm?
@gbarr01 The exact message is:
WARN[0000] network default: network.external.name is deprecated in favor of network.name
Note: I've also found why I couldn't get it it work. My network (intranet) did exist but it was not 'attachable'. Recreating my network with --attachable solved that particular problem it seems :-).
Okay, thanks @Xsysstar , I'll take a look as soon as I can.
@shin- , when you get a chance, is using an attachable network the right solution here?
https://docs.docker.com/compose/networking/#use-a-pre-existing-network
Can confirm this.
Warning message: "[...] network mynet: network.external.name is deprecated in favor of network.name [...]"
In the documentation I only found something about volumes: https://docs.docker.com/compose/compose-file/#external
"[...] external.name was deprecated in version 3.4 file format use name instead [...]"
But this is not about networks...
So how should my brand new (external network) code in version 3.6 look like?
Sorry I missed this.
The recommendation is the same for volumes, networks, secrets and configs ; instead of
foo:
external:
name: something
one should now write
foo:
external: true
name: something
for versions of the format that support it (that's 3.4+ for volumes and 3.5+ for everything else). These two snippets are functionally equivalent.
Closing this ticket due to its age, and the impending refactor. If you think this is in error, feel free to reopen. Thanks!
Why not updating the doc ? https://docs.docker.com/compose/networking/
Most helpful comment
Sorry I missed this.
The recommendation is the same for volumes, networks, secrets and configs ; instead of
one should now write
for versions of the format that support it (that's 3.4+ for volumes and 3.5+ for everything else). These two snippets are functionally equivalent.