apple / apple/container

[Bug]: Stale nameserver in buildkit after network migration

Open
#834 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

### I have done the following

- [x] I have searched the existing issues
- [ ] If possible, I've reproduced the issue using the 'main' branch of this project

### Steps to reproduce

1. Build a container that will cause buildkit to be started
2. container system stop and start had caused me network subset jump to happen; 192.168.64.0/24; then 192.168.65.0/24 and finally only a single network 192.168.66.0/24. Created for this https://github.com/apple/container/issues/835
3. While building again, buildit was started again and ended up with name server of `192.168.64.1`, ```container inspect buildkit | jq```:
```json
[
{
"status": "running",
"configuration": {
"ssh": false,
"dns": {
"nameservers": [
"192.168.64.1"
],
"searchDomains": [],
"options": []
},
// [...]
"networks": [
{
"address": "192.168.66.3/24",
"network": "default",
"gateway": "192.168.66.1",
"hostname": "buildkit"
}
]
```

```
$ container network list
NETWORK STATE SUBNET
default running 192.168.66.0/24
```

The end result is that container is having DNS failures and is not able to

### Current behavior

Invalid stale name server is set

### Expected behavior

Avoid network changes during start/stop of system.
Update the name servers in the container if the network has migrated.

### Environment

```markdown
- OS: 26.0.1 (25A362)
- Xcode:
- Container: container CLI version 0.6.0 (build: release, commit: a23bcf0)
```

### Relevant log output

```shell
N/A
```

### Code of Conduct

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

Contributor guide

Open the contributing guide

Research direction

Start with the reproduction steps, especially the stop/start network migration from 192.168.64.0/24 to 192.168.66.0/24, and compare `container network list` with `container inspect buildkit`. Trace the network and DNS state used when buildkit starts again. Done means buildkit no longer retains the old nameserver after migration and DNS requests succeed.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.