Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manage docker-compose.override.yml file between macOS and Windows?

The situation is that I have three developers working on a project. One developer is on Mac OS X and the other two are on Windows 10 Pro machines. My project consists of .NET Core 3.1 SDK and utilizes docker support to run. It was created in Windows initially so the docker-compose.override.yml file has the following lines of code under Volumes:

- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro

This works perfectly on Windows environments. However on the Mac OS X side the developer constantly has to update the config of docker-compose.override.yml volumn links to look like the following:

- ~/.microsoft/usersecrets:/root/.microsoft/usersecrets:ro
- ~/.aspnet/https:/root/.aspnet/https:ro

Has anyone ever dealt with a situation like this? What did you do to overcome it besides asking the developer to BootCamp or Virtualize Windows 10 on their Mac?

Update:

I just tried to update the docker-compose.override.yml file to accept the Mac OS X volume lines. I ran it on my Windows machine as well as my Mac OS X machine. It seemed to work properly. I have reached out to my developers to test it out on their machines to see if it will work. Once I get their responses I will update this question.

Update #2:

Looks like my developers on both platforms are able to run the docker-compose project using the Mac OS X Volume lines.

like image 883
sroye98 Avatar asked Nov 18 '25 12:11

sroye98


1 Answers

A few options come to mind:

  • Have the Windows devs use WSL so the paths match Mac OS X
  • Declare environment variables for each path and reference those in the config
  • Have an extra compose file that contains the volume declarations but isn't checked into source control so it doesn't get overwritten

I've not done any of these so can't say if there's any pitfalls, but the 2nd and 3rd approaches I have used in the past on non-Docker projects where this kind of scenario occurs.

like image 114
chedabob Avatar answered Nov 21 '25 01:11

chedabob



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!