Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different docker compose override for custom Visual Studio configuration

We have a fairly complex system using docker-compose with a lot of different microservices. I want to be able to run an individual microservice via visual studio with one docker-compose configuration (Debug). Alternatively, I have another configuration (lets call it Debug2) where I want a slightly different docker-compose configuration.

Right now my "docker-compose.yml" file has the basics, and my "docker-compose.override.yml" has some development specific things. I made a "docker-compose.debug.yml". When I run the project in Debug mode, it launches all 3 of those files.

All is well so far, right?

Well, then I tried making a "docker-compose.debug2.yml". I added a new configuration to the project and solution called "Debug2". When I try running from Visual Studio in that mode, it only launches with the first 2 files, and doesn't attempt to use the "debug2" file at all.

Is the system hardcoded to only allow Debug and Release override files? Did I do something wrong or is there an oversight? Any other ideas?

like image 813
Geoff Brown Avatar asked Apr 11 '18 15:04

Geoff Brown


People also ask

Can you have multiple Docker compose?

Using Multiple Docker Compose Files Use multiple Docker Compose files when you want to change your app for different environments (e.g., dev, staging, and production) or when you want to run admin tasks against a Compose application.

What does Docker compose override do?

The docker-compose. override. yml is the configuration file where you can override existing settings from docker-compose. yml or even add completely new services.

How do I pass args in Docker compose?

If you want to pass variables through the docker-compose process into any of the Dockerfiles present within docker-compose. yml , use the --build-arg parameter for each argument to flow into all of the Dockerfiles.


1 Answers

When you are running the services via compose, are you passing the optional override file as well?

For example,

docker-compose -f docker-compose.debug.yml -f docker-compose.debug2.yml

By default, compose only looks for a docker-compose.overrides.yml to my knowledge. Therefore, you would have to pass it as an optional argument when you spin up your environment.

"By default, Compose reads two files, a docker-compose.yml and an optional docker-compose.override.yml file. By convention, the docker-compose.yml contains your base configuration. The override file, as its name implies, can contain configuration overrides for existing services or entirely new services."

For more information: https://docs.docker.com/compose/extends/

like image 130
Thomas Avatar answered Sep 23 '22 23:09

Thomas