Closed nicolasnoble closed 8 years ago
Although I don't have a strong opinion regarding this change, I would like to understand the rationale behind it. Why does a docker-within-docker scenario require to set a different pwd?
The rationale is that if you want to run docker-within-docker, you need to map from the outside world, not from the docker instance. Aka, the inner docker need to use -v with a path from outside the outer docker, not with a path from inside the outer docker. I hope I'm being clear ;-)
So if we want to be able to traverse this, we need to be able to tell the inner docker (aka, rake-compiler-dock in that case) what is the actual external mount to use, instead of the inner "pwd" which is probably wrong.
And a practical example is automated building of artifacts for a given project. The typical way is to use Jenkins which will git clone the code to compile and distribute, spawn a docker container with all the necessary toolchains, mapping the cloned source into it from, for example, $JENKINS_HOME/$BUILD_ID
into /var/jenkins/build
, and start building. Except that when we hit rake gem:windows
, it fails, because rake-compiler-dock is trying to map /var/jenkins/build
instead of $JENKINS_HOME/$BUILD_ID
, and no source is found.
We can make it work by setting something before calling rake gem:windows
, except there's no mapping override in rake-compiler-dock, hence that wishlist issue :-)
In some situations (think docker-within-docker), the sub-mapping of
pwd
can be a bit irregular. It'd be desirable to be able to override it with an environment variable.More specifically, this snipplet:
Could become something along the lines of:
Note that only the left hand of the : should be overridable for this to work.