Skip to main content
added 2 characters in body; edited title
Source Link
Dale K
  • 28.1k
  • 15
  • 59
  • 85

docker-compose dependency on one .NetNET service ruins its healthcheck

I have the following docker-compose.yamldocker-compose.yaml to roll my application. When I comment depends_on on newseo service, containers start with no issue and all healthchecks are passed. However, when I add depends_on back, newseo.api is stuck during its startup with no logs present as well as no connection to {url}/health.

Here is the docker-compose:

services:
  newsseo:
    image: ${DOCKER_REGISTRY-}newsseo
    build:
      context: .
      dockerfile: NewsSEO/Dockerfile
    depends_on:
      newsseo-api:
        condition: service_healthy

  newsseo-api:
    image: ${DOCKER_REGISTRY-}newsseoapi
    build:
      context: .
      dockerfile: NewsSEO.API/Dockerfile
    depends_on:
      postgres:
        condition: service_healthy
    healthcheck:
      test: ["CMD-SHELL", "curl -k -f https://localhost:8081/health || exit 1"]
      interval: 10s
      timeout: 10s
      retries: 3    

  postgres:
    image: postgres:18.0
    ports:
      - "5432:5432"
    environment:
      POSTGRES_PASSWORD: "admin123"
      POSTGRES_USER: "admin"
      POSTGRES_DB: "news_db"  
    healthcheck:
        test: ["CMD-SHELL", "pg_isready"]
        interval: 10s
        timeout: 10s
        retries: 3

I have already added curl in the Dockerfile of newseo:

FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
USER root
RUN apt-get update && apt-get install -y curl
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

Healthcheck in the code of newsseo-api is added with builder.Services.AddHealthChecks() and app.MapHealthChecks("health").

Things I already tried:

  1. Changing https 8081 to http 8080 in the healthcheck.
  2. Increasing interval, timeout and start_period.
  3. Adding restart: on-failure to both services.

docker-compose dependency on one .Net service ruins its healthcheck

I have the following docker-compose.yaml to roll my application. When I comment depends_on on newseo service, containers start with no issue and all healthchecks are passed. However, when I add depends_on back, newseo.api is stuck during its startup with no logs present as well as no connection to {url}/health.

Here is the docker-compose:

services:
  newsseo:
    image: ${DOCKER_REGISTRY-}newsseo
    build:
      context: .
      dockerfile: NewsSEO/Dockerfile
    depends_on:
      newsseo-api:
        condition: service_healthy

  newsseo-api:
    image: ${DOCKER_REGISTRY-}newsseoapi
    build:
      context: .
      dockerfile: NewsSEO.API/Dockerfile
    depends_on:
      postgres:
        condition: service_healthy
    healthcheck:
      test: ["CMD-SHELL", "curl -k -f https://localhost:8081/health || exit 1"]
      interval: 10s
      timeout: 10s
      retries: 3    

  postgres:
    image: postgres:18.0
    ports:
      - "5432:5432"
    environment:
      POSTGRES_PASSWORD: "admin123"
      POSTGRES_USER: "admin"
      POSTGRES_DB: "news_db"  
    healthcheck:
        test: ["CMD-SHELL", "pg_isready"]
        interval: 10s
        timeout: 10s
        retries: 3

I have already added curl in the Dockerfile of newseo:

FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
USER root
RUN apt-get update && apt-get install -y curl
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

Healthcheck in the code of newsseo-api is added with builder.Services.AddHealthChecks() and app.MapHealthChecks("health").

Things I already tried:

  1. Changing https 8081 to http 8080 in the healthcheck.
  2. Increasing interval, timeout and start_period.
  3. Adding restart: on-failure to both services.

docker-compose dependency on one .NET service ruins its healthcheck

I have the following docker-compose.yaml to roll my application. When I comment depends_on on newseo service, containers start with no issue and all healthchecks are passed. However, when I add depends_on back, newseo.api is stuck during its startup with no logs present as well as no connection to {url}/health.

Here is the docker-compose:

services:
  newsseo:
    image: ${DOCKER_REGISTRY-}newsseo
    build:
      context: .
      dockerfile: NewsSEO/Dockerfile
    depends_on:
      newsseo-api:
        condition: service_healthy

  newsseo-api:
    image: ${DOCKER_REGISTRY-}newsseoapi
    build:
      context: .
      dockerfile: NewsSEO.API/Dockerfile
    depends_on:
      postgres:
        condition: service_healthy
    healthcheck:
      test: ["CMD-SHELL", "curl -k -f https://localhost:8081/health || exit 1"]
      interval: 10s
      timeout: 10s
      retries: 3    

  postgres:
    image: postgres:18.0
    ports:
      - "5432:5432"
    environment:
      POSTGRES_PASSWORD: "admin123"
      POSTGRES_USER: "admin"
      POSTGRES_DB: "news_db"  
    healthcheck:
        test: ["CMD-SHELL", "pg_isready"]
        interval: 10s
        timeout: 10s
        retries: 3

I have already added curl in the Dockerfile of newseo:

FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
USER root
RUN apt-get update && apt-get install -y curl
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

Healthcheck in the code of newsseo-api is added with builder.Services.AddHealthChecks() and app.MapHealthChecks("health").

Things I already tried:

  1. Changing https 8081 to http 8080 in the healthcheck.
  2. Increasing interval, timeout and start_period.
  3. Adding restart: on-failure to both services.
deleted 26 characters in body
Source Link

for the other one Hello, community,

I have the following docker-compose.yaml to roll my application. When I comment depends_on on newseo service, containers start with no issue and all healthchecks are passed. However, when I add depends_on back, newseo.api is stuck during its startup with no logs present as well as no connection to {url}/health.

Here is the docker-compose:

services:
  newsseo:
    image: ${DOCKER_REGISTRY-}newsseo
    build:
      context: .
      dockerfile: NewsSEO/Dockerfile
    depends_on:
      newsseo-api:
        condition: service_healthy

  newsseo-api:
    image: ${DOCKER_REGISTRY-}newsseoapi
    build:
      context: .
      dockerfile: NewsSEO.API/Dockerfile
    depends_on:
      postgres:
        condition: service_healthy
    healthcheck:
      test: ["CMD-SHELL", "curl -k -f https://localhost:8081/health || exit 1"]
      interval: 10s
      timeout: 10s
      retries: 3    

  postgres:
    image: postgres:18.0
    ports:
      - "5432:5432"
    environment:
      POSTGRES_PASSWORD: "admin123"
      POSTGRES_USER: "admin"
      POSTGRES_DB: "news_db"  
    healthcheck:
        test: ["CMD-SHELL", "pg_isready"]
        interval: 10s
        timeout: 10s
        retries: 3

I have already added curl in the Dockerfile of newseo:

FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
USER root
RUN apt-get update && apt-get install -y curl
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

Healthcheck in the code of newsseo-api is added with builder.Services.AddHealthChecks() and app.MapHealthChecks("health").

Things I already tried:

  1. Changing https 8081 to http 8080 in the healthcheck.
  2. Increasing interval, timeout and start_period.
  3. Adding restart: on-failure to both services.

for the other one Hello, community,

I have the following docker-compose.yaml to roll my application. When I comment depends_on on newseo service, containers start with no issue and all healthchecks are passed. However, when I add depends_on back, newseo.api is stuck during its startup with no logs present as well as no connection to {url}/health.

Here is the docker-compose:

services:
  newsseo:
    image: ${DOCKER_REGISTRY-}newsseo
    build:
      context: .
      dockerfile: NewsSEO/Dockerfile
    depends_on:
      newsseo-api:
        condition: service_healthy

  newsseo-api:
    image: ${DOCKER_REGISTRY-}newsseoapi
    build:
      context: .
      dockerfile: NewsSEO.API/Dockerfile
    depends_on:
      postgres:
        condition: service_healthy
    healthcheck:
      test: ["CMD-SHELL", "curl -k -f https://localhost:8081/health || exit 1"]
      interval: 10s
      timeout: 10s
      retries: 3    

  postgres:
    image: postgres:18.0
    ports:
      - "5432:5432"
    environment:
      POSTGRES_PASSWORD: "admin123"
      POSTGRES_USER: "admin"
      POSTGRES_DB: "news_db"  
    healthcheck:
        test: ["CMD-SHELL", "pg_isready"]
        interval: 10s
        timeout: 10s
        retries: 3

I have already added curl in the Dockerfile of newseo:

FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
USER root
RUN apt-get update && apt-get install -y curl
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

Healthcheck in the code of newsseo-api is added with builder.Services.AddHealthChecks() and app.MapHealthChecks("health").

Things I already tried:

  1. Changing https 8081 to http 8080 in the healthcheck.
  2. Increasing interval, timeout and start_period.
  3. Adding restart: on-failure to both services.

I have the following docker-compose.yaml to roll my application. When I comment depends_on on newseo service, containers start with no issue and all healthchecks are passed. However, when I add depends_on back, newseo.api is stuck during its startup with no logs present as well as no connection to {url}/health.

Here is the docker-compose:

services:
  newsseo:
    image: ${DOCKER_REGISTRY-}newsseo
    build:
      context: .
      dockerfile: NewsSEO/Dockerfile
    depends_on:
      newsseo-api:
        condition: service_healthy

  newsseo-api:
    image: ${DOCKER_REGISTRY-}newsseoapi
    build:
      context: .
      dockerfile: NewsSEO.API/Dockerfile
    depends_on:
      postgres:
        condition: service_healthy
    healthcheck:
      test: ["CMD-SHELL", "curl -k -f https://localhost:8081/health || exit 1"]
      interval: 10s
      timeout: 10s
      retries: 3    

  postgres:
    image: postgres:18.0
    ports:
      - "5432:5432"
    environment:
      POSTGRES_PASSWORD: "admin123"
      POSTGRES_USER: "admin"
      POSTGRES_DB: "news_db"  
    healthcheck:
        test: ["CMD-SHELL", "pg_isready"]
        interval: 10s
        timeout: 10s
        retries: 3

I have already added curl in the Dockerfile of newseo:

FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
USER root
RUN apt-get update && apt-get install -y curl
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

Healthcheck in the code of newsseo-api is added with builder.Services.AddHealthChecks() and app.MapHealthChecks("health").

Things I already tried:

  1. Changing https 8081 to http 8080 in the healthcheck.
  2. Increasing interval, timeout and start_period.
  3. Adding restart: on-failure to both services.
Source Link

docker-compose dependency on one .Net service ruins its healthcheck

for the other one Hello, community,

I have the following docker-compose.yaml to roll my application. When I comment depends_on on newseo service, containers start with no issue and all healthchecks are passed. However, when I add depends_on back, newseo.api is stuck during its startup with no logs present as well as no connection to {url}/health.

Here is the docker-compose:

services:
  newsseo:
    image: ${DOCKER_REGISTRY-}newsseo
    build:
      context: .
      dockerfile: NewsSEO/Dockerfile
    depends_on:
      newsseo-api:
        condition: service_healthy

  newsseo-api:
    image: ${DOCKER_REGISTRY-}newsseoapi
    build:
      context: .
      dockerfile: NewsSEO.API/Dockerfile
    depends_on:
      postgres:
        condition: service_healthy
    healthcheck:
      test: ["CMD-SHELL", "curl -k -f https://localhost:8081/health || exit 1"]
      interval: 10s
      timeout: 10s
      retries: 3    

  postgres:
    image: postgres:18.0
    ports:
      - "5432:5432"
    environment:
      POSTGRES_PASSWORD: "admin123"
      POSTGRES_USER: "admin"
      POSTGRES_DB: "news_db"  
    healthcheck:
        test: ["CMD-SHELL", "pg_isready"]
        interval: 10s
        timeout: 10s
        retries: 3

I have already added curl in the Dockerfile of newseo:

FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
USER root
RUN apt-get update && apt-get install -y curl
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

Healthcheck in the code of newsseo-api is added with builder.Services.AddHealthChecks() and app.MapHealthChecks("health").

Things I already tried:

  1. Changing https 8081 to http 8080 in the healthcheck.
  2. Increasing interval, timeout and start_period.
  3. Adding restart: on-failure to both services.