clojureleiningendockerubuntu-13.04

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?


Solution

  • 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