Closed StormeNet closed 2 months ago
You can add a label to your docker-compose.yml or docker-compose.override.yml to associate the service with the project.
build:
blah..blah
labels:
com.microsoft.visual-studio.project-name: "TestforDocker"
https://github.com/microsoft/DockerTools/issues/355#issuecomment-1355506604
Thanks! It would be great if this was in the official documentation.
Agreed, we plan to update our docs. Thanks!
I hope I don't step on anyone's toes here, but yesterday a colleague showed me how he does this in a one of the competition's IDE (Rider), and it was just setting a path to the docker-compose.yml and selecting which service(s) to attach to and debug. Not even five minutes of work.
Now here I'm working to get the same done in visual studio and it has taken me so far two days. And this only because the docker-compose.yml
is up a few directories and so are the dockerfiles. And furthermore, implementing this dcproj way of doing things, forces to update my dockerfiles as the dotnet restore
now can't find the *.dcproj
which is defined in the solution parent directory, so I need to update those to restore not the solution but the csproj
files.
This seems to be a lot of hassle for something so trivial. Hope you guys can simplify this in the future.
Thanks for your feedback! We will look into how we can simplify making this association.
I hope I don't step on anyone's toes here, but yesterday a colleague showed me how he does this in a one of the competition's IDE (Rider), and it was just setting a path to the docker-compose.yml and selecting which service(s) to attach to and debug. Not even five minutes of work.
Now here I'm working to get the same done in visual studio and it has taken me so far two days. And this only because the
docker-compose.yml
is up a few directories and so are the dockerfiles. And furthermore, implementing this dcproj way of doing things, forces to update my dockerfiles as thedotnet restore
now can't find the*.dcproj
which is defined in the solution parent directory, so I need to update those to restore not the solution but thecsproj
files.This seems to be a lot of hassle for something so trivial. Hope you guys can simplify this in the future.
You are absolutely not stepping on toes, and, in fact, I'd love to learn more about how we can improve this. Would you be willing to spend 15 min with me walking through this? I want to completely understand what you're seeing and talk through some ideas on how to improve. If so, you can book time on my calendar here: https://aka.ms/MeetWithMatt
Visual Studio does not show a debug option when using a Docker compose project (.dcproj) and the Dockerfile is not in the project folder but up the directory tree.
Here's my file structure:
This causes that there's not an
Start Debugging
option in the "Manage Docker Compose Launch Settings"I assumed this could be fixed by adding the following to
TestForDocker.csproj
:However this does not seem to work in combination with
For reference, here's the
docker-compose.yml
:And the
docker-compose.dcproj
: