Mercurial > hg-stable
changeset 24970:33055069e465
dockerlib: fix initcontainer for boot2docker users
This allows me to build rpm packages using boot2docker on my Mac. It's
probably a very fragile hack, but it seems to work well enough for now
that I felt it was worth sharing.
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 06 May 2015 14:36:17 -0400 |
parents | 227b9b2a57a3 |
children | ab75baaf81d5 |
files | contrib/dockerlib.sh |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/dockerlib.sh Wed May 06 10:45:51 2015 -0400 +++ b/contrib/dockerlib.sh Wed May 06 14:36:17 2015 -0400 @@ -29,7 +29,14 @@ DBUILDUSER=build ( cat $DFILE - echo RUN groupadd $DBUILDUSER -g `id -g` - echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER + if [ $(uname) = "Darwin" ] ; then + # The builder is using boot2docker on OS X, so we're going to + # *guess* the uid of the user inside the VM that is actually + # running docker. This is *very likely* to fail at some point. + echo RUN useradd $DBUILDUSER -u 1000 + else + echo RUN groupadd $DBUILDUSER -g `id -g` + echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER + fi ) | $DOCKER build --tag $CONTAINER - }