Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a Docker image command in a mounted folder

I'm trying to execute lein run in a Clojure Docker image out of a mounted folder that is not /, but when I try to cd into a folder, Docker complains with unable to locate cd:

docker run -v /root/chortles:/test -i jphackworth/docker-clojure cd /test && lein run
=> Unable to locate cd

How do I instruct Leiningen to run in a different folder, or tell Docker to change the directory prior to running my command?

like image 522
Petrus Theron Avatar asked Mar 31 '26 03:03

Petrus Theron


1 Answers

You can use -w param for docker run. This parameter is useful for specifying working directory within container.

docker run -w /test -v /root/chortles:/test -i jphackworth/docker-clojure lein run
like image 121
Jiri Avatar answered Apr 02 '26 14:04

Jiri



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!