Docker noob here.
I have a docker directory at project root. It contains some docker compose files, say, docker-compose-{1..5}.yml. I want to run docker compose up (Note: not docker-compose). Searching docker documentation, SO, Internet, all I can find is references to run as in
$ project_root/docker: docker-compose -f docker-compose-1.yml -f docker-compose-2.yml -f docker-compose-2.yml up
However, while trying help doc for docker compose shows
$: docker compose --help
Usage: docker compose [OPTIONS] COMMAND
Docker Compose
Options:
--ansi string Control when to print ANSI control characters ("never"|"always"|"auto") (default "auto")
--env-file string Specify an alternate environment file.
-f, --file stringArray Compose configuration files
--profile stringArray Specify a profile to enable
--project-directory string Specify an alternate working directory
(default: the path of the Compose file)
-p, --project-name string Project name
Commands:
build Build or rebuild services
.
.
.
up Create and start containers
Run 'docker compose COMMAND --help' for more information on a command.
MY QUERY IS
How to pass multiple files to docker compose in one go using single -f flag as mentioned in doc using stringArray? What is the format?
I tried, but no success:
$: docker compose -f "file1.yml" "file2.yml" up # nope
$: docker compose -f ["file1.yml" "file2.yml"] up # nope
$: docker compose -f ["file1.yml", "file2.yml"] up #nope
$: docker compose -f {"file1.yml" "file2.yml"} up #nope
$: docker compose -f ("file1.yml" "file2.yml") up #nope
# and some other combinations thereof.
EDIT#1:
I had checked this post but it does not answer my query. I am specifically looking for passing multiple string values (my compose files path) to the command docker compose using a single -f flag, much like - hey compose, I got these files and I want you to run these rather than run this, run this, run this.
Now I am confused if it is even possible or I have to use multiple -f one for each file. But the help doc should not mention then
Usage: docker compose [OPTIONS] COMMAND
Docker Compose
Options:
-f, --file stringArray Compose configuration files # <-- It says files here