Add some wrappers to support at least the default uid mapping

The busybox adduser and addgroup commands are ignored by docker,
as it avoids symlinks, but they are not compatible so this is
kind of a good idea.

See https://github.com/docker/docker/blob/master/pkg/idtools/usergroupadd_linux.go

However, these do not yet deal with creating mapping ranges in /etc/subuid and
/etc/subgid, so initially we provide a set that match the default docker name
so at least docker daemon --userns-remap=default should work.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2016-02-10 15:47:37 -08:00
parent 6ee7b22152
commit 8cc82ba98b
5 changed files with 21 additions and 0 deletions

View File

@ -48,6 +48,9 @@ COPY packages/hvtools/etc /etc/
COPY packages/hvtools/hv_get_dhcp_info /sbin/
COPY packages/hvtools/hv_get_dns_info /sbin/
COPY packages/hvtools/hv_set_ifconfig /sbin/
COPY packages/userns/etc /etc/
COPY packages/userns/groupadd /usr/sbin
COPY packages/userns/useradd /usr/sbin
RUN \
rc-update add swap boot && \

View File

@ -0,0 +1 @@
dockremap:100000:65536

View File

@ -0,0 +1 @@
dockremap:100000:65536

View File

@ -0,0 +1,3 @@
#!/bin/sh
exec /usr/sbin/addgroup $@

13
alpine/packages/userns/useradd Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
for a in $*
do
[ "$a" = "-N" ] && a=""
[ "$a" = "-M" ] && a="-H"
[ "$a" = "-g" ] && a="-G"
args="$args $a"
done
echo $args
exec /usr/sbin/adduser -D ${args}