'VSCode Docker Compose Up command customization with docker-compose.yaml in different folders

I have a project composed of many microservices developed in Java intended to be run in Docker containers. These microservices work without any errors and the containers communicate well between them using Docker CLI, but I'm having trouble configuring VSCode Docker Extension settings to be able to do some Command Customization.

I have all the folders of every microservice I'm working on in the same Workspace and also a folder with my configurations for Docker similar to this:

├── first-service
├── second-service    
├── third-service
├── fouth-service
├── fifth-service
├── (...)
├── containerfiles
│   ├── my_config_1
│   │   ├── docker-compose.yaml
│   │   └── Dockerfile
│   ├── my_config_2
│   │   ├── artifact
│   │   │   └── first-service.jar
│   │   ├── config-files
│   │   ├── docker-compose.yaml
│   │   └── Dockerfile
│   └── my_config_3
│       ├── artifact
│       │   └── second-service.jar
│       ├── docker-compose.yaml
│       └── Dockerfile

I had trouble understanding what files and how to change them (I've read the documentation but it's not as clear as I think it should...) and I finally get the following to work.

In my_workspace.code-workspace file under settings module I have:

"settings": {
    "docker.commands.composeUp": [
        {
            "label": "first-service",
            "template": "docker-compose ${configurationFile} up ${detached} ${build}",
            "match": "first-service"
        },
        {
            "label": "second-service",
            "template": "docker-compose ${configurationFile} up ${detached} ${build}",
            "match": "second-service"
        }
    ],

(...)
}

For this to work, I need to right-click the docker-compose.yaml file and select Compose Up for these custom commands to work just for two I've done tests.

TL;DR

The question is: Is there a way to be able to use this folder structure and my different Docker files in different folders than the microservices with the command: F1 > Docker: Compose Up

Select workspace folder in some way to avoid having to rick-click the docker-compose files? (As these are shared with many microservices depending on which one is it)

At present if I use this option I got the following:

Couldn't find any docker-compose files in your workspace. Would you like to add Docker files to the workspace?

Answering YES forces me to create new Docker files in every microservice folder and I don't want this.

Thank you in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source