Skip to content

Commit aea536a

Browse files
committed
fix
1 parent 7603b3c commit aea536a

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

samcli/lib/constants.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
import os
2-
from samcli.cli.global_config import GlobalConfig
3-
4-
DOCKER_MIN_API_VERSION = os.environ.get(GlobalConfig.DOCKER_API_ENV_VAR, "1.35")
1+
DOCKER_MIN_API_VERSION = "1.35"
52
DOCKER_MIN_API_VERSION_FALLBACK = "1.44"

samcli/local/docker/container_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import docker
3333
from docker.utils import kwargs_from_env
3434

35+
from samcli.cli.global_config import GlobalConfig
3536
from samcli.lib.constants import DOCKER_MIN_API_VERSION, DOCKER_MIN_API_VERSION_FALLBACK
3637
from samcli.local.docker.exceptions import ContainerArchiveImageLoadFailedException, ContainerInvalidSocketPathException
3738
from samcli.local.docker.platform_config import get_finch_socket_path
@@ -87,14 +88,15 @@ def __init__(self, base_url=None):
8788

8889
# Always start with environment variables
8990
current_env = os.environ.copy()
91+
print(current_env)
9092
self.client_params = kwargs_from_env(environment=current_env)
9193

9294
# Override base_url if explicitly provided
9395
if base_url is not None:
9496
self.client_params["base_url"] = base_url
9597

9698
# Specify minimum version
97-
self.client_params["version"] = DOCKER_MIN_API_VERSION
99+
self.client_params["version"] = os.environ.get(GlobalConfig.DOCKER_API_ENV_VAR, DOCKER_MIN_API_VERSION)
98100

99101
# Initialize DockerClient with processed parameters
100102
LOG.debug(f"Creating container client with parameters: {self.client_params}")

tests/unit/local/docker/test_container_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,8 +751,8 @@ def test_init_with_base_url_override(self, mock_log, mock_docker_init):
751751
self.assertTrue(mock_log.debug.called)
752752

753753
@patch("docker.DockerClient.__init__", return_value=None)
754-
def test_init_with_base_url_override(self, mock_log, mock_docker_init):
755-
"""Test ContainerClient init with base_url override"""
754+
def test_init_with_api_override(self, mock_docker_init):
755+
"""Test ContainerClient init with api override"""
756756
override_api = "1.51"
757757

758758
with patch.dict("os.environ", {GlobalConfig.DOCKER_API_ENV_VAR: override_api}, clear=True):

0 commit comments

Comments
 (0)