Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker run passing command line params as config file

Tags:

docker

In docker-compose there is a .env file which can hold all the properties of used in docker-compose.yml

Is there an equivalent of that in docker run command? I have exhausted the docs and forums but couldn't find any answers.

Here is what I am looking for: Rather than docker run -v /dir1:/dir1 -v /dir2:dir2 -p 80:80 repo/image

run docker run -config config.yml repo/image' with config.yml file holding all the property mappings

like image 449
Shantanu Wagh Avatar asked Dec 04 '25 10:12

Shantanu Wagh


1 Answers

One option could be to have the parameters stored in a file and just get the string of the file using cat:

docker run $(cat config.file) repo/image

Where config.file content should be something like:

-v /dir1:/dir1 -v /dir2:dir2 -p 80:80
like image 177
Don Charlie Avatar answered Dec 07 '25 09:12

Don Charlie



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!