apple / apple/container

[Request]: DNS server should allow listening outside of localhost

Open
#1,302 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
49.9k
Forks
1.8k
Avg merge
1d 20h
Merged PRs (30d)
22

Description

### Feature or enhancement request details

For the usecases where we'd like to autodiscover containers' IPs using built-in DNS server we should be able to reach it from outside of the host.
Currently however this is hardcoded in https://github.com/apple/container/blob/main/Sources/Helpers/APIServer/APIServer%2BStart.swift to:
static let listenAddress = "127.0.0.1"
We then see two DNS servers, 1053 and 2053, both of which listen on 127.0.0.1

There seems to be a switch during DNS domain creation, which does the magic of being able to resolve on specified IP **locally:**
```
sudo container system dns create --localhost 192.168.1.64 container-dns
nslookup -port=2053 example.container-dns 192.168.1.64
Server: 192.168.1.64
Address: 192.168.1.64#2053

Name: example.container-dns
Address: 192.168.65.13
```
But doesn't work from another machine, actually it is even worse as that BLOCKS incoming SSH/screen sharing connections? Probably misunderstanding what the option is for.

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Research direction

Start in Sources/Helpers/APIServer/APIServer+Start.swift, where the listen address is set, and reproduce the behavior with `container system dns create` and the shown `nslookup` commands. Done means the built-in DNS servers can be reached from outside the host while preserving the documented local resolution behavior and not disrupting incoming host connections.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.