Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

path to "docker-compose.yml" as a parameter

Today in order to launch my docker containers specified/included in my docker-compose.yml file, I first go to the folder where the docker-compose.yml is located and then I type:

docker-compose up -d

and it works very well!

WHAT IF I wish to run that "docker-compose up" command from a different folder (not from inside the folder where docker-compose.yml is located):

I tried:

docker-compose up -d -f /data/....../docker-compose.yml

but that did not work as I received a warning that did redisplay all the possible options and "-f" was not 1 of of the option listed.

So how do I specify a path to "docker-compose.yml" as a CLI parameter to my "docker-compose up" command ?

like image 937
MMEL Avatar asked Sep 19 '25 10:09

MMEL


1 Answers

docker-compose is pretty picky about which parts of the command take options. In this case, docker-compose up doesn't take a -f option.

However, docker-compose itself does take a -f option. Try running:

docker-compose -f /data/......./docker-compose.yml up -d
like image 131
TylerLubeck Avatar answered Sep 23 '25 10:09

TylerLubeck



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!