mirror of
https://github.com/docker/compose.git
synced 2025-04-08 17:05:13 +02:00
Engine API only allows at most one network to be connected as part of the ContainerCreate API request. Compose will pick the highest priority network. Afterwards, the remaining networks (if any) are connected before the container is actually started. The big change here is that, previously, the highest-priority network was connected in the create, and then disconnected and immediately reconnected along with all the others. This was racy because evidently connecting the container to the network as part of the create isn't synchronous, so sometimes when Compose tried to disconnect it, the API would return an error like: ``` container <id> is not connected to the network <network> ``` To avoid needing to disconnect and immediately reconnect, the network config logic has been refactored to ensure that it sets up the network config correctly the first time. Signed-off-by: Milas Bowman <milas.bowman@docker.com>