Skip to content

Commit

Permalink
Add IPv6 warning to ue4-docker info output (see #357)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamrehn committed Jun 21, 2024
1 parent 070dd3c commit 632bee7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
12 changes: 2 additions & 10 deletions src/ue4docker/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,13 @@ def build():
)
sys.exit(1)

# Warn the user if they're using an older version of Docker that can't build or run UE 5.4 images without config changes
# Warn the user if they're using an older version of Docker that can't build or run UE 5.4 Linux images without config changes
if (
config.containerPlatform == "linux"
and DockerUtils.isVersionWithoutIPV6Loopback()
):
logger.warning(
"\n".join(
[
"Warning: detected a Docker version older than 26.0.0.",
"Older versions of Docker cannot build or run images for Unreal Engine 5.4 or",
"newer unless the Docker daemon is explicitly configured to enable IPv6 support.",
"For details, see: https://github.com/adamrehn/ue4-docker/issues/357",
"",
]
),
DockerUtils.getIPV6WarningMessage() + "\n",
False,
)

Expand Down
5 changes: 5 additions & 0 deletions src/ue4docker/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,8 @@ def info():
item[0], " " * ((longestName + minSpaces) - len(item[0])), item[1]
)
)

# Warn the user if they're using an older version of Docker that can't build or run UE 5.4 Linux images without config changes
if DockerUtils.isVersionWithoutIPV6Loopback():
logger = Logger(prefix="")
logger.warning(DockerUtils.getIPV6WarningMessage())
28 changes: 26 additions & 2 deletions src/ue4docker/infrastructure/DockerUtils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import docker, fnmatch, humanfriendly, itertools, json, logging, os, platform, re
import docker, fnmatch, humanfriendly, itertools, json, logging, os, platform, re, sys
from docker.models.containers import Container
from packaging.version import Version

Expand Down Expand Up @@ -33,14 +33,38 @@ def info():
client = docker.from_env()
return client.info()

@staticmethod
def minimumVersionForIPV6():
"""
Returns the minimum version of the Docker daemon that supports IPv6 by default
without requiring manual configuration by the user
"""
return Version("26.0.0")

@staticmethod
def isVersionWithoutIPV6Loopback():
"""
Determines if the version of the Docker daemon lacks support for using the
IPv6 loopback address [::1] when using its default network configuration
"""
dockerVersion = Version(DockerUtils.version()["Version"])
return dockerVersion < Version("26.0.0")
return dockerVersion < DockerUtils.minimumVersionForIPV6()

@staticmethod
def getIPV6WarningMessage():
""" """
return "\n".join(
[
f"Warning: detected a Docker version older than {DockerUtils.minimumVersionForIPV6()}.",
"Older versions of Docker cannot build or run Linux images for Unreal Engine 5.4 or",
"newer unless the Docker daemon is explicitly configured to enable IPv6 support.",
"",
"To test whether IPv6 support is working, run the following diagnostic test:",
f"{sys.argv[0]} diagnostics ipv6",
"",
"For more details, see: https://github.com/adamrehn/ue4-docker/issues/357",
]
)

@staticmethod
def exists(name):
Expand Down

0 comments on commit 632bee7

Please sign in to comment.