Skip to content

need to restart after external network changes -- seems needs to use 'fixed' DNS... #70

Description

@yarikoptic

here is my question/response to claude

❯ in this environment (claude code under podman) if external network changes (e.g. I go from home to work), client looses connection:                 
                                                                                                                                                      
  API Error: Unable to connect to API (EAI_AGAIN)                                                                                                     
                                                                                                                                                      
  is that a problem with podman or claude code and how to overcome?                                                                                   

● This is a Podman networking issue, not Claude Code. The EAI_AGAIN error means DNS resolution failed.

  Root cause: Podman containers get a snapshot of /etc/resolv.conf at creation time. When your host network changes (home → work), the host gets new
  DNS servers, but the container still has the stale DNS config.

  Solutions (pick one):

  1. Easiest — use host networking:
  podman run --network=host ...
  1. Container shares the host's network stack directly, including DNS updates.
  2. Use a fixed public DNS:
  podman run --dns=8.8.8.8 --dns=1.1.1.1 ...
  2. These are always reachable regardless of which network you're on.
  3. If using systemd-resolved on the host, the stub resolver at 127.0.0.53 should handle transitions, but Podman may not pick it up. Check:
  podman run --dns=127.0.0.53 ...
  3. (Only works with --network=host or if the stub is reachable from the container network.)
  4. Restart the container after network change — crude but works if the above aren't options.

  Recommendation: --dns=8.8.8.8 is the simplest fix that doesn't require --network=host (which has security trade-offs). If you're already using
  --network=host, then the issue might be that your host's own DNS resolver is slow to update — in that case, adding --dns=8.8.8.8 to the podman run
  command still helps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions