Our Senior Sitecore Developer's advice to find "docker-compose.vs.debug.yml"

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.

Author bio

Benjamin Moles
Benjamin Moles
Sitecore Developer
My goal is to return happiness to clients' faces by getting their issues and questions solved. As a Technical Service Manager I provide the required resources to support clients' applications and infrastructure. I also enjoy playing with remote-controlled helicopters.


comments powered by Disqus

Related Articles

Sign up to our ClearThought newsletter

Get inspired and learn something new by subscribing to our FREE newsletter. It’s full of ClearPeople's thought-leadership whitepapers, blogs, events, and much more. We promise to not use your email for spam.

Closing this message and/or accessing our website tells us you are happy to receive all cookies on the ClearPeople website.
However, if you would like to, you can change your cookies settings at any time.