Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Run the iptable rule for localhost during container initialization #54

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkg/docker/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ func (e *EventMonitor) initializeRunningContainers(ctx context.Context) error {
if err := e.portTracker.Add(container.ID, portMap); err != nil {
log.Errorf("registering already running containers failed: %v", err)
}

for _, netSettings := range container.NetworkSettings.Networks {
err = createLoopbackIPtablesRules(
netSettings.IPAddress,
portMap)

if err != nil {
log.Errorf("failed running iptable rules to update DNAT rule in DOCKER chain: %v", err)
}
}
}
}

Expand Down