balena-io / docs

Documentation for the balenaCloud platform.
https://docs.balena.io/
Apache License 2.0
68 stars 357 forks source link

document that udev + network_mode: host causes modem issues #956

Open shaunmulligan opened 5 years ago

shaunmulligan commented 5 years ago

It seems that the combination of udev and network_mode: host causes cellular modems to be replugged after a container restart, which often will result in the modem never reconnecting.

The recommendation for modem based applications is to use a microservices application type and add a docker-compose.yml that looks as follows:

version: '2.1'
networks: {}
volumes:
  resin-data: {}
services:
  main:
    build:
      context: .
    privileged: true
    restart: always
    # network_mode: host
    volumes:
      - 'resin-data:/data'
    labels:
      io.resin.features.kernel-modules: '1'
      io.resin.features.firmware: '1'
      io.resin.features.dbus: '1'
      io.resin.features.supervisor-api: '1'
      io.resin.features.resin-api: '1'

the reason has to do with https://github.com/systemd/systemd/issues/6713 and the way udev in the container handles network namespaces.

imrehg commented 5 years ago

Interesting. on the other hand, for in-container udev events I found that network_mode: host might be needed....

vipulgupta2048 commented 3 years ago

Need to investigate this further, if it works now or not before adding a fix for it.