I hate the vibe
Build and Push Docker Images / build-and-push (push) Failing after 13s

This commit is contained in:
2025-07-02 10:00:22 +02:00
parent ef362ad23a
commit f31ee9ac15
3 changed files with 58 additions and 18 deletions
+24 -7
View File
@@ -31,13 +31,8 @@ class PuppeteerHealthcheck:
self.target_container = os.getenv('TARGET_CONTAINER', 'puppeteer-api')
self.check_interval = int(os.getenv('CHECK_INTERVAL', '60'))
# Initialize Docker client
try:
self.docker_client = docker.from_env()
logger.info("Docker client initialized successfully")
except Exception as e:
logger.error(f"Failed to initialize Docker client: {e}")
raise
# Initialize Docker client with proper error handling
self.docker_client = self._initialize_docker_client()
logger.info(f"Healthcheck initialized with:")
logger.info(f" Base URL: {self.base_url}")
@@ -45,6 +40,28 @@ class PuppeteerHealthcheck:
logger.info(f" Target Container: {self.target_container}")
logger.info(f" Check Interval: {self.check_interval} seconds")
def _initialize_docker_client(self):
"""Initialize Docker client with proper error handling"""
try:
# Try to initialize Docker client
client = docker.from_env()
# Test the connection by getting Docker info
client.info()
logger.info("Docker client initialized successfully")
return client
except docker.errors.DockerException as e:
logger.error(f"Docker client initialization failed: {e}")
logger.error("This usually means the Docker socket is not accessible or permissions are incorrect.")
logger.error("Make sure to:")
logger.error(" 1. Mount the Docker socket: -v /var/run/docker.sock:/var/run/docker.sock")
logger.error(" 2. Run with proper permissions or add the container to the docker group")
raise
except Exception as e:
logger.error(f"Unexpected error initializing Docker client: {e}")
raise
def perform_health_check(self):
"""Perform the health check by making a request to the puppeteer API"""
try: