cmds: allow users to change the container network configuration

In some spare situations it might be useful to change the network
configuration of the bridge and with that also the configuration of
the Android container itself. We don't validate the configuration
and just apply it no matter if it ends up with network connectivity
in the container.
This commit is contained in:
Simon Fels 2018-08-10 07:30:58 +02:00
commit 568a483435
7 changed files with 76 additions and 6 deletions

View file

@ -70,6 +70,21 @@ start() {
EXTRA_ARGS="$EXTRA_ARGS --privileged"
fi
container_network_address=$(snapctl get container.network.address)
if [ -n "$container_network_address" ]; then
EXTRA_ARGS="$EXTRA_ARGS --container-network-address=$container_network_address"
fi
container_network_gateway=$(snapctl get container.network.gateway)
if [ -n "$container_network_gateway" ]; then
EXTRA_ARGS="$EXTRA_ARGS --container-network-gateway=$container_network_gateway"
fi
container_network_dns=$(snapctl get container.network.dns)
if [ -n "$container_network_dns" ]; then
EXTRA_ARGS="$EXTRA_ARGS --container-network-dns-servers=$container_network_dns"
fi
exec "$SNAP"/bin/anbox-wrapper.sh container-manager \
--data-path="$DATA_PATH" \
--android-image="$ANDROID_IMG" \