balena-io-modules / balena-compose

Complete toolkit for building docker-compose.yml files and optionally deploy them on balenaCloud
Apache License 2.0
8 stars 1 forks source link

Docker compose validation allows both `networks` and `network_mode` #49

Open pipex opened 7 months ago

pipex commented 7 months ago

The following composition is rejected by docker-compose with service hello declares mutually exclusivenetwork_modeandnetworks: invalid compose project

version: '2.4'

services: 
  hello:
    image: alpine
    command: ['sleep', 'infinity']
    networks: ['my-network']
    network_mode: host

networks:
  my-network:

While balena-compose allows it. Making the change might prevent invalid or ambiguous compositions reaching the supervisor