Repository navigation
docker: run: support extra options - #141
Merged
Merged
Conversation
Some use cases need extra options for 'docker run', e.g. '--network host' to start VMs from the container connected to tap interfaces created on the host: by default, the container has its own network namespace, and QEMU creates new tap interfaces there, not connected to anything. The new DOCKER_EXTRA_ARGS environment variable can be used to pass such options, split on whitespace, e.g. $ DOCKER_EXTRA_ARGS="--network host" docker/selftests/run.sh vng (...) It can be set in the environment of a systemd service, and is then inherited when executing commands via docker/selftests/wrapper.sh. Signed-off-by: Matthieu Baerts <matttbe@kernel.org>
'sudo' was added to let QEMU create tap interfaces in the network namespace of the container: with rootless Podman, only root in the container has CAP_NET_ADMIN there. But these interfaces are not connected to anything, while tests like the virtio_net ones expect tap interfaces created and wired up on the host. To use them, '--network host' can be passed via DOCKER_EXTRA_ARGS. In this case, QEMU cannot create tap interfaces -- even root in the container has no CAP_NET_ADMIN in the host network namespace -- but it can attach to existing ones owned by the same user. With rootless Podman and 'keep-id', that's the case for the user in the container, not for root, which is mapped to a different UID on the host. So drop 'sudo': the VMs are then started as the same user as on the host, like before using the container. Fixes: b801813 ("docker: selftests: wrapper: run 'vng --run' with sudo") Signed-off-by: Matthieu Baerts <matttbe@kernel.org>
Member
Author
|
(Hopefully the last one...) Exceptionally merging without review to deploy this workaround. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some use cases need extra options for 'docker run', e.g. '--network host' to start VMs from the container connected to tap interfaces created on the host: by default, the container has its own network namespace, and QEMU creates new tap interfaces there, not connected to anything.
The new
DOCKER_EXTRA_ARGSenvironment variable can be used to pass such options, split on whitespace, e.g.It can be set in the environment of a systemd service, and is then inherited when executing commands via
docker/selftests/wrapper.sh.