Skip to content

Commit

Permalink
Merge pull request #3749 from BenTheElder/ip6tables-missing
Browse files Browse the repository at this point in the history
docker: detect ip6tables setup failure and fallback to ipv4 only
  • Loading branch information
BenTheElder authored Oct 7, 2024
2 parents 874ab2f + 43c99ea commit b404897
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/cluster/internal/providers/docker/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,17 @@ func checkIfNetworkExists(name string) (bool, error) {

func isIPv6UnavailableError(err error) bool {
rerr := exec.RunErrorForError(err)
return rerr != nil && strings.HasPrefix(string(rerr.Output), "Error response from daemon: Cannot read IPv6 setup for bridge")
if rerr == nil {
return false
}
errorMessage := string(rerr.Output)
// we get this error when ipv6 was disabled in docker
const dockerIPV6DisabledError = "Error response from daemon: Cannot read IPv6 setup for bridge"
// TODO: this is fragile, and only necessary due to docker enabling ipv6 by default
// even on hosts that lack ip6tables setup.
// Preferably users would either have ip6tables setup properly or else disable ipv6 in docker
const dockerIPV6TablesError = "Error response from daemon: Failed to Setup IP tables: Unable to enable NAT rule: (iptables failed: ip6tables"
return strings.HasPrefix(errorMessage, dockerIPV6DisabledError) || strings.HasPrefix(errorMessage, dockerIPV6TablesError)
}

func isPoolOverlapError(err error) bool {
Expand Down

0 comments on commit b404897

Please sign in to comment.