Skip to content

Commit

Permalink
Check ipv6 docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
dangoncalves committed Jan 27, 2022
1 parent d9d4c83 commit 0dd6ea8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
prepare-test:
check-docker:
@python check_docker_ipv6_support.py

build-test-image:
@docker build -f Dockerfile-test-healthcheck -t docker-dns:test-healthcheck-1.0 .

prepare-test: build-test-image check-docker

test:
@python -m tests
18 changes: 18 additions & 0 deletions check_docker_ipv6_support.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python3

import docker
import sys
from ipaddress import ip_network, IPv6Network

client = docker.from_env()

for network in client.networks.list():
subnets = network.attrs['IPAM']['Config']
for subnet in subnets:
address = ip_network(subnet['Subnet'])
if isinstance(address, IPv6Network):
print("Docker has ipv6 support")
sys.exit(0)

print("Docker has no ipv6 support")
sys.exit(1)

0 comments on commit 0dd6ea8

Please sign in to comment.