An issue recently came up (https://github.com/groovy/docker-groovy/issues/61)
where it was necessary to run the container with a certain uid/gid so that
the container would have access to a mounted volume.  Because Grapes will
normally try to download into the user's home, this was a problem since
that directory didn't exist.  I had issues similar to this in the Gradle
image I also maintain, and because some CI systems don't let you specify
the user to run with I ended up having to just run as root inside the
container.

The possible solutions here are

   1. chmod the groovy user's home, to make it world writable (with sticky
   bit).  This would still require the user to run their scripts with -D
   user.home=/home/groovy to override the non-existent location.
   2. Change the image to run as root

The first option is a less invasive change, and avoids running as root,
which I prefer (though the Docker Library team officially has no position
on this), and would solve the immediate problem.  The only downside would
be if you mounted some volume in order to do file manipulation in your
Groovy script, this would not work.  However, this is a use case that so
far hasn't been brought up.  The downside of switching to root is that it's
possible it'd break some existing users (I suspect it's not super-likely,
but it's possible).

Any opinions on how I should proceed?

-Keegan

Reply via email to