A compose service can only join one network
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.
container 1.5.0 now boots a container on several networks, so compose services join every network they list. Verified with web [front], api [front, back], db [back]: api reaches both, web cannot reach db, and service names resolve only across shared networks. Shipped in #98.
mocker network connect / disconnect still depend on the runtime adding a way to attach a running container.
Released in v0.9.5 (brew upgrade mocker). Closing.