VisualStudio debug services on Docker-Compose not starting

BenT 15 Reputation points
2023-03-20T13:49:46.3733333+00:00

Hi,

I try to debug 3 services using Docker-Compose in VS 2022.

ServiceC depends on ServiceB which depends on ServiceA.

All of these "depends*on" use condition: service_*healthy and every service has a healtcheck.

VS will only start container A and when it is healthy it starts B which never gets healthy bc only the container is run but the service inside will not be executed and never gets healthy.

Everything works fine without VS when using docker-compose.

I can provide an example project if somebody wants to test.

Any idea what's wrong here?


version: '3.4'

services:
  dependsontest:
    image: ${DOCKER_REGISTRY-}dependsontest
    build:
      context: .
      dockerfile: DependsOnTest/Dockerfile
    healthcheck:
      test: curl --silent --fail http://localhost:1224/WeatherForecast || exit 1
      interval: 5s 
      timeout: 5s 
      retries: 5

  dependsontest_b:
    image: ${DOCKER_REGISTRY-}dependsontestb
    build:
      context: .
      dockerfile: DependsOnTest_B/Dockerfile
    healthcheck:
      test: curl --silent --fail http://localhost:1224/WeatherForecast || exit 1
      interval: 5s 
      timeout: 5s 
      retries: 5
    depends_on:
      dependsontest:
        condition: service_healthy


  dependsontest_c:
    image: ${DOCKER_REGISTRY-}dependsontestc
    build:
      context: .
      dockerfile: DependsOnTest_C/Dockerfile
    healthcheck:
      test: curl --silent --fail http://localhost:1224/WeatherForecast || exit 1
      interval: 5s 
      timeout: 5s 
      retries: 5
    depends_on:
      dependsontest_b:
        condition: service_healthy

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,077 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,512 questions
{count} votes