Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"docker-compose" command to set path for docker-compose.yml file

Reading the help by docker-compose -h, or this official manual, will give us the option --project-directory PATH

docker-compose [-f ...] [options] [COMMAND] [ARGS...]

--project-directory PATH Specify an alternate working directory (default: the path of the compose file)

But I tried to call the below command and failed - I have ensured the file at ./mySubFolder/docker-compose.yml has already been created.

docker-compose --project-directory ./mySubFolder up 

The error

Can't find a suitable configuration file in this directory or anyparent.

Are you in the right directory?

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

What I did wrong? How to pass the parameter properly?

like image 748
Nam G VU Avatar asked Jul 17 '17 13:07

Nam G VU


People also ask

Where is location Docker compose yml?

The default path for a Compose file is ./docker-compose.yml .

How do I run a YAML file in Docker compose?

To run and open . yml files you have to install Docker Compose. After the installation, go to your docker-compose. yml directory and then execute docker-compose up to create and start services in your docker-compose.

Which is the command to check your Docker compose file?

You can also see this information by running docker compose --help from the command line. You can use Docker Compose binary, docker compose [-f <arg>...]


1 Answers

Use the -f param instead --project-directory view details

You can use -f flag to specify a path to Compose file that is not located in the current directory

docker-compose -f ~/sandbox/rails/docker-compose.yml pull db 
like image 81
Nam G VU Avatar answered Oct 21 '22 11:10

Nam G VU