Skip to content

extra_hosts not supported in app.yaml — Python apps cannot resolve local network hostnames #328

@hybotix

Description

@hybotix

Describe the problem

Problem

Python apps run inside Docker containers with an isolated network
(e.g. arduino-securesmars_default). This prevents apps from
resolving local network hostnames such as pimqtt.local or any
other mDNS/local DNS hostname.

The host's /etc/hosts is not inherited by the container, and
mDNS multicast does not pass through Docker's network isolation.

Expected behavior

Apps should be able to connect to local network services by hostname,
including mDNS hostnames (*.local) and entries in the host's /etc/hosts.

What I tried

  • Adding extra_hosts to app.yaml — ignored, not added to generated compose file
  • Adding hostname to /etc/hosts on the UNO Q — not inherited by container
  • The generated .cache/app-compose.yaml only contains the default
    msgpack-rpc-router:host-gateway extra_hosts entry with no way to add more

Suggested fix

Either:

  1. Support extra_hosts in app.yaml and pass them through to the generated compose file
  2. Use network_mode: host for the container
  3. Document a supported way to configure Docker networking for apps

Platform

  • UNO Q BSP: 0.54.1
  • arduino-app-cli: 0.8.0
  • Use case: connecting to a local Mosquitto MQTT broker by hostname

To reproduce

Steps to Reproduce

  1. Create an app with a Python script that connects to a local network
    service by hostname (e.g. a Mosquitto MQTT broker at pimqtt.local)
  2. Run arduino-app-cli app start <app_path>
  3. Check app logs — connection fails with:
    socket.gaierror: [Errno -2] Name or service not known
  4. Inspect .cache/app-compose.yaml — container uses isolated Docker
    network arduino-<appname>_default with no access to host DNS or mDNS
  5. Adding the hostname to /etc/hosts on the UNO Q does not help —
    the container does not inherit the host's /etc/hosts
  6. Adding extra_hosts to app.yaml does not help — it is silently
    ignored and not passed through to the generated compose file

Expected behavior

Expected Behavior

A Python app should be able to connect to local network services by
hostname, including:

  • mDNS hostnames (*.local) such as pimqtt.local
  • Hostnames defined in the host's /etc/hosts
  • Any hostname resolvable on the local network

This is standard behavior for any application running on the UNO Q
outside of the Docker container, and should be equally available to
apps managed by arduino-app-cli.

Arduino App CLI version

Arduino App CLI version 0.8.4 daemon version: 0.8.4

Additional context

Additional Information

  • The generated .cache/app-compose.yaml uses an isolated Docker network
    (arduino-<appname>_default) rather than host networking
  • The extra_hosts field appears in the arduino-app-cli JSON schema
    (found via strings /usr/bin/arduino-app-cli) but is silently ignored
    when specified in app.yaml
  • This issue affects any app that needs to connect to a local network
    service by hostname — MQTT brokers, local APIs, local databases, etc.
  • Workaround requires manually editing .cache/app-compose.yaml after
    every app start, which is not a sustainable solution
  • Using network_mode: host in the compose file resolves the issue but
    there is no supported way to configure this from app.yaml

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest version
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions