Instance registers the docker0 ip address
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 357
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
We have an onprem server (rocky linux 8) with SSM agent (amazon-ssm-agent-3.2.2016.0-1.x86_64).
At AWS Fleet Manager we have that instance registered with the ip address from docker0 (172.17.0.1):

It was working fine until we lost the dhcp for a few hours and now even after restarting the SSM agent, I always get the docker0's IP registered.
If I do an `ifconfig docker0 down; systemctl restart amazon-ssm-agent.service; ifconfig docker0 up` it works (registers the correct ip) but after some time, it gets back to the previous docker0 ip address registered in SSM.
I think it's the code at `agent/platform/platform.go` that is sorting the interfaces differently (guessing):
```
if interfaces, err = net.Interfaces(); err == nil {
interfaces = filterInterface(interfaces)
sort.Sort(byIndex(interfaces))
candidates := make([]net.IP, 0)
```
What would be the best option here (except rebooting the server)?
Contributor guide
Research direction
Start in agent/platform/platform.go, reading the net.Interfaces, filterInterface, and byIndex ordering path, then reproduce registration with docker0 present on Rocky Linux 8. Done means the agent consistently registers the correct host IP after restart and remains correct when interfaces change, with the behavior covered by an appropriate test if the repository provides one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go, linux
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100