How to wait for another Windows Docker container while Debugging in Visual Studio

Sascha Paulus 21 Reputation points
2021-01-28T11:39:56.21+00:00

Hello,

I use Docker and docker-compose to start several API projects in one Visual Studio solution.

Since the Docker parameter depends_on does not wait for those other containers/services to start healthy it is hard to control the order of container execution.

I could override the entrypoint of one container with a script to check the existence/running of his dependencies.
Docker officially recommends using this bash script "https://github.com/vishnubob/wait-for-it"

Problem (1): It is bash script, how could I use it in a windows container based on mcr.microsoft.com/dotnet/core/aspnet:3.1

... So I wrote an old-school batch file to curl/ping the url of the dependent service.

Problem (2): The docker-compose implementation of Visual Studio (Debugging) ignores the ENTRYPOINT in the Dockerfile.
To override the entrypoint in Debug mode I have to override the entrypoint in a file named docker-compose.vs.debug.yml.

But if you do this, you have to make sure the connection to the remote-debugger (msvsmon.exe) is still part of the entrypoint.
Which I have done by coping whats in the docker-compose.vs.debug.g.yml file, but then other problems occurs.

So before I waste another year of my life ...

My question:
What is the best way in Visual Studio (Debug Mode with docker-compose) to ensure a dependent container is running before starting the actual container ?

Thanks, Sascha

Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
944 questions
0 comments No comments
{count} votes

Accepted answer
  1. Anna Xiu-MSFT 25,801 Reputation points Microsoft Vendor
    2021-01-29T03:38:53.837+00:00

    Hi @Sascha Paulus ,

    Currently, Microsoft Q&A supports the products listed over here: supported topics (more to be added later on).
    Your question about Docker Tool is not supported currently.

    You can ask in the dedicated DockerTools forum over here: https://github.com/microsoft/dockertools/issues .

    Sincerely,
    Anna

    • If the answer is helpful, please click "Accept Answer" and upvote it.
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Sascha Paulus 21 Reputation points
    2021-01-29T13:30:52.08+00:00

    Ok, thanks. After a long and painful search, I found the Github link and the proper issue already.
    https://github.com/microsoft/DockerTools/issues/9 Spoiler alert: No solution for an obvious problem in sight. :(

    0 comments No comments