Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2017 stopped running docker-compose

In Visual Studio 2017 I am working on a project with 3 dotnet core projects. It was building and starting the containers using docker-compose as the startup project. Now it is giving me an error that it cannot find the container starting with a given name. In the Output window in the Show output from: docker selected it shows the combined docker-compose.yml files.

It appears that it is not building the containers, hence why it cannot find the container it is looking for by name. After seeing this I ran all the docker commands in PowerShell and it built the images and started the containers right up. With the containers in place Visual Studio started, but gave me a different error.

I'm wondering why Visual Studio would not be building the containers anymore.

Note: I have had trouble in the past when spinning up the containers using docker cli that Visual Studio would throw exceptions, but I have cleaned docker running containers, network, volume, and images...

enter image description here

Thanks for your help in advance. I am loving docker, but there are some frustrations when using the VS tools thus far...

like image 359
CarBar Avatar asked Apr 21 '17 20:04

CarBar


People also ask

How do I run a docker compose file in Visual Studio code?

You can then use the Docker Compose Up command (right-click on the docker-compose. yml file, or find the command in the Command Palette) to get everything started at once. You can also use the docker-compose up command from the command prompt or terminal window in VS Code to start the containers.

What is Dcproj?

Development project created by Dashcode, a developer IDE used for creating dashboard widgets and iOS Safari Web apps; includes the designed layout, graphics, and scripted logic for interactive elements; written using HTML, JavaScript, and CSS.


2 Answers

In my case I had Resharper's build enabled, which confused Visual Studio. Switching to normal Visual Studio build in Resharper -> Options -> Tools -> Build solved the problem for me.

It also helps sometimes to right-click on the docker-compose item in Visual Studio, then choosing "Clean". This causes Visual Studio to call docker-compose kill, giving you a fresh slate. Note that the output from this process appears in the "Build" window, not the "Docker" one.

like image 166
willem Avatar answered Oct 18 '22 20:10

willem


Make sure that in Build > Configuration Manager that you have the Docker project set to build in Debug mode - this being unticked caused this issue for me and re-ticking it proved to be the solution.

like image 44
DenverCoder9 Avatar answered Oct 18 '22 22:10

DenverCoder9