Skip to content

docker: run: support extra options - #141

Merged
matttbe merged 2 commits into
linux-netdev:mainfrom
matttbe:docker-extra-args
Nov 17, 2026
Merged

matttbe merged 2 commits into
linux-netdev:mainfrom
matttbe:docker-extra-args

Conversation

@matttbe

@matttbe matttbe commented Nov 17, 2026

Copy link
Copy Markdown
Member

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.

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>
@matttbe

matttbe commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

(Hopefully the last one...) Exceptionally merging without review to deploy this workaround.

@matttbe
matttbe merged commit d514595 into linux-netdev:main Nov 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant