Skip to content

Commit

Permalink
[docker] Increase container timeout (#4835)
Browse files Browse the repository at this point in the history
* [docker] Increase container timeout

* Add changelog

* Update demisto_sdk/commands/common/docker_helper.py

Co-authored-by: Koby Meir <[email protected]>

* fix

---------

Co-authored-by: Koby Meir <[email protected]>
  • Loading branch information
mmhw and kobymeir authored Feb 25, 2025
1 parent 16fe31e commit e88f4d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .changelog/4835.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changes:
- description: Increase Docker container timeout when creating a new Docker image.
type: feature
pr_number: 4835
5 changes: 3 additions & 2 deletions demisto_sdk/commands/common/docker_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
)

TEST_REQUIREMENTS_DIR = Path(__file__).parent.parent / "lint" / "resources"
DOCKER_CONTAINER_TIMEOUT = int(os.getenv("DOCKER_CONTAINER_TIMEOUT") or 300)


class DockerException(Exception):
Expand Down Expand Up @@ -100,7 +101,7 @@ def init_global_docker_client(timeout: int = 60, log_prompt: str = ""):
logger.debug(
"Gitlab CI use case detected, trying to create docker client from Gitlab CI job environment."
)
DOCKER_CLIENT = docker.from_env()
DOCKER_CLIENT = docker.from_env(timeout=timeout)
if DOCKER_CLIENT.ping():
# see https://docker-py.readthedocs.io/en/stable/client.html#docker.client.DockerClient.ping for more information about ping().
logger.debug(
Expand Down Expand Up @@ -355,7 +356,7 @@ def create_container(
"""
Creates a container and pushing requested files to the container.
"""
docker_client = init_global_docker_client()
docker_client = init_global_docker_client(timeout=DOCKER_CONTAINER_TIMEOUT)

try:
container: docker.models.containers.Container = (
Expand Down

0 comments on commit e88f4d7

Please sign in to comment.