skip to Main Content

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
enter image description here

2

Answers


  1. To create a Docker Compose Profile in VS 2022 you want to create a project that has "Enable Docker" checked when creating a projectEnable Docker in 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"enter image description here

    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.enter image description here

    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"enter image description here

    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 optionenter image description here

    You can also check out this link from Microsoft Docs Github for more info

    Login or Signup to reply.
  2. 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:

    services:
      s1:
        image: s1
        profiles:
        - p1
      s2:
        image: s2
        profiles:
        - p2
      shared:
        image: shared
    

    Gives you:
    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search