Skip to content

Commit

Permalink
Check Docker versions to ensure internal resolving works in test envi…
Browse files Browse the repository at this point in the history
…ronment.

Due to a change in Docker's DNS resolver (moby/moby#47589) in version 25.0.5 (https://docs.docker.com/engine/release-notes/25.0/#2505), traffic to the mock resolver used in integration/batch tests is no longer forwarded. This is fixed in moby/moby#47822 in version 26.0.3 (https://docs.docker.com/engine/release-notes/26.0/#2603).

- Temporary add upgrade commands to CI because 26.0.3 is not yet in the default CI image
- Add checks to warn about incompatible versions
- Add documentation to help developers get the right versions
  • Loading branch information
aequitas committed May 31, 2024
1 parent 0e85771 commit 696e65c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,12 @@ jobs:
PY_COLORS: "1"

steps:
- if: ${{ matrix.os }} == ubuntu-24.04
name: Upgrade to at least Docker 26.1.3 to fix DNS issues
run: |
sudo apt update
sudo apt install --upgrade docker-ce
- name: Enable ip6tables in Docker
run: |
sudo bash -c 'echo "{ \"ip6tables\": true, \"experimental\":true}" > /etc/docker/daemon.json'
Expand Down Expand Up @@ -527,6 +533,12 @@ jobs:
PY_COLORS: "1"

steps:
- if: ${{ matrix.os }} == ubuntu-24.04
name: Upgrade to at least Docker 26.1.3 to fix DNS issues
run: |
sudo apt update
sudo apt install --upgrade docker-ce
- name: Enable ip6tables in Docker
run: |
sudo bash -c 'echo "{ \"ip6tables\": true, \"experimental\":true}" > /etc/docker/daemon.json'
Expand Down
1 change: 1 addition & 0 deletions documentation/Docker-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ An OCI compatible container runtime with [Compose V2](https://docs.docker.com/co
- [Docker](https://docs.docker.com/get-docker/) for Linux, (supported, tested version 24.0.2)
- [Docker](https://docs.docker.com/get-docker/) for Mac (supported, tested version 4.21.0)
- [Colima](https://github.com/abiosoft/colima) for Mac (recommended, tested version 0.5.5)
- [OrbStack](https://orbstack.dev/download) for Mac (non open source, free, tested version 1.6.1)
- [Docker](https://docs.docker.com/get-docker/) for Windows (untested)

**notice**: newer versions of Docker (25+) might experience issues with internal DNS resolver. This is possibly a bug in Docker Compose:
Expand Down
21 changes: 20 additions & 1 deletion integration_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import time
import subprocess
import os
from packaging.version import Version

# primary URL for internet.nl test website
APP_DOMAIN = "internet.test"
Expand Down Expand Up @@ -199,7 +200,7 @@ def pytest_report_header(config):

try:
docker_compose_version = subprocess.check_output(
" docker compose version --short", shell=True, universal_newlines=True
"docker compose version --short", shell=True, universal_newlines=True
).strip()
except Exception:
docker_compose_version = "n/a"
Expand All @@ -215,3 +216,21 @@ def print_red(*args):
print("\033[91m", end=None)
print(*args)
print("\033[0m", end=None)


@pytest.fixture(autouse=True)
def check_docker_version():
"""Some versions of Docker/Compose are incompatible because of the way their networking/DNS
works. Check this and instruct the user how to resolve the issues."""

docker_server_version = subprocess.check_output(
"docker version --format '{{.Server.Version}}'",
shell=True,
universal_newlines=True,
).strip()

if Version("25.0.5") <= Version(docker_server_version) < Version("26.0.3"):
pytest.fail(
f"Docker Server version {docker_server_version} not compatible, refer to "
"`documentation/Docker-getting-started.md#Prerequisites` for more info."
)

0 comments on commit 696e65c

Please sign in to comment.