Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run docker-compose with custom file name [duplicate]

I have this file: docker-compose.test.yml

But when I try to run docker-compose, this happens:

$ docker-compose up
ERROR:
        Can't find a suitable configuration file in this directory or any
        parent. Are you in the right directory?

        Supported filenames: docker-compose.yml, docker-compose.yaml

Is there some option to specify which file to use?

like image 576
Ostap Brehin Avatar asked Nov 29 '20 12:11

Ostap Brehin


People also ask

Is it possible to run multiple copies of a compose file on the same host?

Compose uses the project name to create unique identifiers for all of a project's containers and other resources. To run multiple copies of a project, set a custom project name using the -p command line option or the COMPOSE_PROJECT_NAME environment variable.

Can I change the docker compose file name?

The default filename is docker-compose. yml . You can name the manifest name as you like, but you have to pass the filename in the docker-compose command.

How do I handle multiple files in docker compose?

To use multiple override files, or an override file with a different name, you can pass the -f option to the docker-compose up command. The base Compose file has to be passed on the first position of the command.


1 Answers

Use -f option to specify the file name.

Example:

docker-compose -f docker-compose.test.yml up
like image 86
Ostap Brehin Avatar answered Oct 08 '22 00:10

Ostap Brehin