VisualStudio debug services on Docker-Compose not starting

BenT 20 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,560 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,129 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ilya Fedorov 0 Reputation points
    2024-10-09T08:14:49.96+00:00

    I had similar issue. Try to set action in Docker Compose Launch Settings to Start debugging for every project.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.