Finding “docker-compose.vs.debug.yml”

Posted 12 June 2018 12:00 AM by Benjamin Moles, Senior Developer @ ClearPeople

While I was learning about Docker with Visual Studio 2017 I was kind of busy with something that resulted way easier that I had thought. Below I have written a few lines that can hopefully help someone else. 

In the training from Pluralsight “Introduction to Docker on Windows with Visual Studio 2017“ by Marcel de Vries, as in other publications like this and this one, you can see how, by adding support for Docker to a Visual Studio 2017 project, the following elements in the solution appear: 

  • New Visual Studio Project named “docker-compose” with the following files:
    • docker-compose.yml
    • docker-compose.override.yml
    • docker-compose.vs.debug.yml
    • docker-compose.vs.release.yml
  • New files within the project where support has been added for Docker:
    • Dockerfile
    • .dockerignore

The files docker-compose.vs.debug.yml” and “docker-compose.vs.release.yml” are very useful to define specific container characteristics for the development and production environments. For example, it could be interesting to use “volume” for the website folder in IIS when developing, facilitating to overwrite the files in this phase, and later, when we are going to do a release, the same folder can be introduced in the container, so it facilitates its deployment. 

When adding Docker support to an existing VS solution, I was quite surprised to see that the files “docker-compose.vs.debug.yml”, and “docker-compose.vs.release.yml” weren’t created. The version of Visual Studio 2017 that I used was 15.5.7.

On the other hand, in the “Output” window in Visual Studio, when compiling the project “docker-compose.dcproj” the following lines appeared:

docker-compose -f “c:\Docker\Sitecore82TDS\docker-compose.yml” -f “c:\Docker\Sitecore82TDS\docker-compose.override.yml” -f “c:\Docker\Sitecore82TDS\obj\Docker\docker-compose.vs.debug.g.yml” -p dockercompose6697759991785308464 config

docker-compose -f “c:\Docker\Sitecore82TDS\docker-compose.yml” -f “c:\Docker\Sitecore82TDS\docker-compose.override.yml” -f “c:\Docker\Sitecore82TDS\obj\Docker\docker-compose.vs.debug.partial.g.yml” -p dockercompose6697759991785308464 kill 

docker-compose -f “c:\Docker\Sitecore82TDS\docker-compose.yml” -f “c:\Docker\Sitecore82TDS\docker-compose.override.yml” -f “c:\Docker\Sitecore82TDS\obj\Docker\docker-compose.vs.debug.partial.g.yml” -p dockercompose6697759991785308464 down –rmi local –remove-orphans 

There are two details in these lines that confused me: 

  • It seems that VS2017 is using the name “docker-compose.vs.debug.partial.g.yml” or “docker-compose.vs.debug.g.yml” instead of “docker-compose.vs.debug.yml“. 
  • The location of both files in within “obj/Docker”.  

In the first instance I though that VS had changed the name of the file and its location. Moreover, there are two folders with the path “obj/Docker”. One is being created within the original project (where support has been added for Docker) and the other is created by VS from scratch (where the solution file *.sln is). The one being used by VS to generate the container is the second one, where you can find the following files:  

  • docker-compose.vs.debug.g.yml 
  • docker-compose.vs.debug.partial.g.yml 

After doing various tests I noticed that VS is generating both files in each compilation (“Build”). Actually, you can’t use any of these to add to the container specific development changes.   

Finally, the solution was the simplest one. You just need to manually create the files “docker-compose.vs.debug.yml”, and “docker-compose.vs.release.yml” in the folder where the project “docker-compose.dcproj” is also saved. Only the existence of it is enough for VS to detect the files and to use them, although I prefer to add them also to the project docker-compose.dcproj”. The steps are as follows: 

  1. In VS2017, right-click on the project “docker-compose” and then click on “Unload Project”. 
  2. Right-click again on the project “docker-compose” and this time choose “Edit ‘docker-compose.dcproj'”
  3. Search for the following lines in the file of the project:
    <None Include=”docker-compose.override.yml”>
    <None Include=”docker-compose.yml” />
  4. Replace the previous lines with the following ones:
    <None Include=”docker-compose.vs.debug.yml“>
    <None Include=”docker-compose.vs.release.yml“>

    <None Include=”docker-compose.override.yml”>
    <None Include=”docker-compose.yml” />
  5. Save the file “docker-compose.dcproj” and close it.
  6. Create two text files and name them “docker-compose.vs.debug.yml”, and “docker-compose.vs.release.yml” in the same folder where the project “docker-compose.dcproj” is saved.
  7. In VS2017, load the project “docker-compose” again by double-clicking on it’s name and choose “Reload Project”  

Once that’s done, VS detects the new files and directly uses them as you can see in the following line taken from the Output window in VS:  

docker-compose -f “c:\Docker\Sitecore82TDS\docker-compose.yml” -f “c:\Docker\Sitecore82TDS\docker-compose.override.yml” -f “c:\Docker\Sitecore82TDS\docker-compose.vs.debug.yml” -p dockercompose6697759991785308464 config 


More information about Docker to come next week in my new blog!

Please also read my previous blog about Sitecore demo in a Docker Container



Add your comment





intranet Modern SharePoint teamwork employee engagement digital workspace SharePoint JavaScript Windows Azure Digital Transformation staff satisfaction productivity Microsoft Teams Office 365 Yammer cms content management system agile GDPR Microsoft Graph collaboration Microsoft sharepoint 2016 upgrade migration SharePoint Online 2016 Tech Trends Digital Disruption Context marketing marketing SharePoint 2010 SharePoint 2013 TFS Git security kentico Analytics jquery QA Quality Assurance testing content management websites Sitecore sitecore marketplace sitecore module cloud Microsoft Cloud Storage digital strategy technical consulting sitecore modules Experience database Sitecore 7 Sitecore 8 support account management customer experience Data Storage cms integration front end front end development prototype Cloud Storage StorSimple Front-end Development Layout SharePoint 2013 colour palette UI design website design log viewer sitecore cms website Azure big data business-critical sharepoint accessibility android apple chrome clear people clearpeople debug emulator ios mobile testing opera resize adobe desktop flash ie10 internet explorer 10 metro windows 8 bcsp Advanced System Reporter reporting framework ControlMode form control master page placeholder publishing console SharePoint 2007 SharePoint error search search results search values software testing testing scenario audit content information architecture retention schedules PowerShell QuickLaunch scripts SharePoint server 2010 business solutions metalogix replication replicator storagepoint stena technet UK Technet picture library slideshow web part RTM released to manufacturing caml caml query MOSS 2007 query infopath