|
@@ -9,7 +9,9 @@
|
|
# External dependencies:
|
|
# External dependencies:
|
|
# * newuidmap and newgidmap needs to be installed.
|
|
# * newuidmap and newgidmap needs to be installed.
|
|
# * /etc/subuid and /etc/subgid needs to be configured for the current user.
|
|
# * /etc/subuid and /etc/subgid needs to be configured for the current user.
|
|
-# * Either slirp4netns (v0.3+) or VPNKit needs to be installed.
|
|
|
|
|
|
+# * Either one of slirp4netns (v0.3+), VPNKit, lxc-user-nic needs to be installed.
|
|
|
|
+# slirp4netns is used by default if installed. Otherwise fallsback to VPNKit.
|
|
|
|
+# The default value can be overridden with $DOCKERD_ROOTLESS_ROOTLESSKIT_NET=(slirp4netns|vpnkit|lxc-user-nic)
|
|
#
|
|
#
|
|
# See the documentation for the further information.
|
|
# See the documentation for the further information.
|
|
|
|
|
|
@@ -35,24 +37,32 @@ if [ -z $rootlesskit ]; then
|
|
exit 1
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
|
|
-net=""
|
|
|
|
-mtu=""
|
|
|
|
-if which slirp4netns >/dev/null 2>&1; then
|
|
|
|
- if slirp4netns --help | grep -- --disable-host-loopback; then
|
|
|
|
- net=slirp4netns
|
|
|
|
- mtu=65520
|
|
|
|
- else
|
|
|
|
- echo "slirp4netns does not support --disable-host-loopback. Falling back to VPNKit."
|
|
|
|
- fi
|
|
|
|
-fi
|
|
|
|
|
|
+: "${DOCKERD_ROOTLESS_ROOTLESSKIT_NET:=}"
|
|
|
|
+: "${DOCKERD_ROOTLESS_ROOTLESSKIT_MTU:=}"
|
|
|
|
+net=$DOCKERD_ROOTLESS_ROOTLESSKIT_NET
|
|
|
|
+mtu=$DOCKERD_ROOTLESS_ROOTLESSKIT_MTU
|
|
if [ -z $net ]; then
|
|
if [ -z $net ]; then
|
|
- if which vpnkit >/dev/null 2>&1; then
|
|
|
|
- net=vpnkit
|
|
|
|
- mtu=1500
|
|
|
|
- else
|
|
|
|
- echo "Either slirp4netns (v0.3+) or vpnkit needs to be installed"
|
|
|
|
- exit 1
|
|
|
|
|
|
+ if which slirp4netns >/dev/null 2>&1; then
|
|
|
|
+ if slirp4netns --help | grep -- --disable-host-loopback; then
|
|
|
|
+ net=slirp4netns
|
|
|
|
+ if [ -z $mtu ]; then
|
|
|
|
+ mtu=65520
|
|
|
|
+ fi
|
|
|
|
+ else
|
|
|
|
+ echo "slirp4netns does not support --disable-host-loopback. Falling back to VPNKit."
|
|
|
|
+ fi
|
|
fi
|
|
fi
|
|
|
|
+ if [ -z $net ]; then
|
|
|
|
+ if which vpnkit >/dev/null 2>&1; then
|
|
|
|
+ net=vpnkit
|
|
|
|
+ else
|
|
|
|
+ echo "Either slirp4netns (v0.3+) or vpnkit needs to be installed"
|
|
|
|
+ exit 1
|
|
|
|
+ fi
|
|
|
|
+ fi
|
|
|
|
+fi
|
|
|
|
+if [ -z $mtu ]; then
|
|
|
|
+ mtu=1500
|
|
fi
|
|
fi
|
|
|
|
|
|
if [ -z $_DOCKERD_ROOTLESS_CHILD ]; then
|
|
if [ -z $_DOCKERD_ROOTLESS_CHILD ]; then
|
|
@@ -66,7 +76,8 @@ if [ -z $_DOCKERD_ROOTLESS_CHILD ]; then
|
|
# (by either systemd-networkd or NetworkManager)
|
|
# (by either systemd-networkd or NetworkManager)
|
|
# * /run: copy-up is required so that we can create /run/docker (hardcoded for plugins) in our namespace
|
|
# * /run: copy-up is required so that we can create /run/docker (hardcoded for plugins) in our namespace
|
|
$rootlesskit \
|
|
$rootlesskit \
|
|
- --net=$net --mtu=$mtu --disable-host-loopback --port-driver=builtin \
|
|
|
|
|
|
+ --net=$net --mtu=$mtu \
|
|
|
|
+ --disable-host-loopback --port-driver=builtin \
|
|
--copy-up=/etc --copy-up=/run \
|
|
--copy-up=/etc --copy-up=/run \
|
|
$DOCKERD_ROOTLESS_ROOTLESSKIT_FLAGS \
|
|
$DOCKERD_ROOTLESS_ROOTLESSKIT_FLAGS \
|
|
$0 $@
|
|
$0 $@
|