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?
The default path for a Compose file is ./docker-compose.yml .
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.
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>...]
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With