Skip to content
Merged
Show file tree
Hide file tree
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
22 changes: 16 additions & 6 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,25 @@ check_optional_env_vars() {
fi
}

# Set DOCKER_API_VERSION based on architecture
# Set DOCKER_API_VERSION based on Docker daemon's current API version
set_docker_api_version() {
local arch=$(uname -m)
if [ "$arch" = "arm64" ] || [ "$arch" = "aarch64" ]; then
export DOCKER_API_VERSION=1.43
# Get the server's current API version (what it actually supports)
local server_api=$(docker version --format '{{.Server.APIVersion}}' 2>/dev/null || echo "")

if [ -n "$server_api" ]; then
# Use the server's current API version for full compatibility
export DOCKER_API_VERSION="$server_api"
log_info "Set DOCKER_API_VERSION=$DOCKER_API_VERSION (server current)"
else
export DOCKER_API_VERSION=1.44
# Fallback: set based on architecture
local arch=$(uname -m)
if [ "$arch" = "arm64" ] || [ "$arch" = "aarch64" ]; then
export DOCKER_API_VERSION=1.44
else
export DOCKER_API_VERSION=1.44
fi
Comment on lines +103 to +109
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fallback logic is redundant as both branches of the conditional set DOCKER_API_VERSION to the same value (1.44). The architecture check doesn't actually influence the version selection. Either remove the architecture-based conditional or set different versions for different architectures if that's the intended behavior.

Suggested change
# Fallback: set based on architecture
local arch=$(uname -m)
if [ "$arch" = "arm64" ] || [ "$arch" = "aarch64" ]; then
export DOCKER_API_VERSION=1.44
else
export DOCKER_API_VERSION=1.44
fi
# Fallback: set a default API version, still logging architecture
local arch=$(uname -m)
export DOCKER_API_VERSION=1.44

Copilot uses AI. Check for mistakes.
log_info "Set DOCKER_API_VERSION=$DOCKER_API_VERSION for $arch (fallback)"
fi
log_info "Set DOCKER_API_VERSION=$DOCKER_API_VERSION for $arch"
}

# Main execution
Expand Down
12 changes: 6 additions & 6 deletions run_containerized.sh
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,13 @@ validate_log_directory_mount() {

# Set DOCKER_API_VERSION based on architecture and Docker daemon requirements
set_docker_api_version() {
# First, check what the Docker daemon requires as minimum API version
local min_api=$(docker version --format '{{.Server.MinAPIVersion}}' 2>/dev/null || echo "")
# Get the server's current API version (what it actually supports)
local server_api=$(docker version --format '{{.Server.APIVersion}}' 2>/dev/null || echo "")

if [ -n "$min_api" ]; then
# Use the daemon's minimum API version to ensure compatibility
export DOCKER_API_VERSION="$min_api"
log_info "Set DOCKER_API_VERSION=$DOCKER_API_VERSION (daemon minimum)"
if [ -n "$server_api" ]; then
# Use the server's current API version for full compatibility
export DOCKER_API_VERSION="$server_api"
log_info "Set DOCKER_API_VERSION=$DOCKER_API_VERSION (server current)"
else
# Fallback: set based on architecture
local arch=$(uname -m)
Comment on lines 238 to 239
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fallback logic is redundant as both branches of the conditional set DOCKER_API_VERSION to the same value (1.44). The architecture check doesn't actually influence the version selection. Either remove the architecture-based conditional or set different versions for different architectures if that's the intended behavior.

See below for a potential fix:

        # Fallback: use a default API version when server API cannot be detected
        export DOCKER_API_VERSION=1.44
        log_info "Set DOCKER_API_VERSION=$DOCKER_API_VERSION (fallback default)"

Copilot uses AI. Check for mistakes.
Expand Down