From the docs on network_mode:
When [network mode is] set, the
networksattribute is not allowed and Compose rejects any Compose file containing both attributes.
Further, networks: must be set to one of the following:
nonehost (Gives the container raw access to the host's network interface)service:{name}container:{name}