Compose lets a service list several networks:
services:
api:
networks: [frontend, backend]
mocker joins the first and warns on stderr which one it picked. The limit is the runtime, not the parsing: attaching a container to two networks fails inside the guest.
$ container run --network neta --network netb -d --name multinet alpine:3.20 sleep 15
Error: failed to bootstrap container (cause: "internalError: "failed to bootstrap container multinet (cause: \"unknown: \"internalError: \"ipRouteAddDefault\"\"\")"")
So a project that relies on network segmentation (a service reachable from one network but not another) cannot be reproduced faithfully — everything the first network can reach, it reaches.
Two things would need to change: ContainerConfig.network becoming a list and the runtime accepting more than one attachment. The second is the blocker, and container network has no connect subcommand to add one after the fact either — which is also why mocker network connect/disconnect report that they are unsupported.
Tracking this so the limitation is visible rather than surprising. Ref #80.
Compose lets a service list several networks:
mocker joins the first and warns on stderr which one it picked. The limit is the runtime, not the parsing: attaching a container to two networks fails inside the guest.
So a project that relies on network segmentation (a service reachable from one network but not another) cannot be reproduced faithfully — everything the first network can reach, it reaches.
Two things would need to change:
ContainerConfig.networkbecoming a list and the runtime accepting more than one attachment. The second is the blocker, andcontainer networkhas noconnectsubcommand to add one after the fact either — which is also whymocker network connect/disconnectreport that they are unsupported.Tracking this so the limitation is visible rather than surprising. Ref #80.