In the Microsoft website, they are showing multiple Docker Compose Profiles. Anybody know how to create it?
https://learn.microsoft.com/en-us/visualstudio/containers/launch-profiles?view=vs-2022#create-a-launch-profile-that-uses-a-docker-compose-profile
2
Answers
To create a Docker Compose Profile in VS 2022 you want to create a project that has "Enable Docker" checked when creating a project
You can also add Docker support to existing projects. Right click the project you want to add Docker to and click the Add option and add "Docker Support"
After you have done that Right click the project you want to add Docker Compose Profiles to and click the Add option and add Container Orchestration Support and when the popup window appears choose Docker Compose as your option.
You then will notice a new project has been added to your VS 2022 Solution called "docker-compose". Right click on the docker-compose project and click on the "Manage Docker Compose Launch Settings"
You should then get the Pop-Up window that was shown in the link you provided. You can edit launch settings here or modify the launchSettings.json directly. launchSettings.json will be created after you setup the Launch Settings in the popup window and then press save..
To add more projects for the Launch Settings Profile in the pop window just add more services to your docker compose manually(recommended by myself) or delete the docker compose, add all the projects you may need to the solution first and then recreate the docker-compose and then the launch settings will populate itself with all the services in the docker-compose.
To start Docker Compose with your Lauch Settings change the Project that starts up when debugging to the docker-compose option
You can also check out this link from Microsoft Docs Github for more info
The portion of the UI you’re pointing to dynamically pops in when you have specified profiles for your services: https://docs.docker.com/compose/compose-file/#profiles
For example:
Gives you: