mviereck / x11docker

Run GUI applications and desktops in docker and podman containers. Focus on security.
MIT License
5.68k stars 379 forks source link

Unable to launch x11docker when `--network` is specified #463

Closed SimplicityGuy closed 2 years ago

SimplicityGuy commented 2 years ago

With this commit: https://github.com/mviereck/x11docker/commit/e50feeb4c25a94e37e549dcd0c01b6b8218fa8ac, it is no longer possible to run an image with x11dock when --network=... is specified by the user. Please revert or rework this change.

SimplicityGuy commented 2 years ago

This was also missed in the release notes, requiring code inspection to find that --hostname was now being set.

mviereck commented 2 years ago

Thank you for the report! Sorry that this caused trouble for you. This change was just intended to be a minor convenience to make it easier seeing which container belongs to which open windows. As a quite minor feature I did not mention it in the release notes. I have removed the --hostname code, it should work now again. May I ask how exactly this caused trouble with --network?

SimplicityGuy commented 2 years ago

Thanks for the fix! Using --hostname and --network is incompatible per Docker, when using --network=container:vpn. I get this error:

conflicting options: hostname and the network mode

See the Docker run reference:

Network: container With the network set to container a container will share the network stack of another container. The other container’s name must be provided in the format of --network container:<name|id>. Note that --add-host --hostname --dns --dns search --dns-option and --mac-address are invalid in container netmode, and --publish --publish-all --expose are also invalid in container netmode.

SimplicityGuy commented 2 years ago

So, given that, perhaps the fix here could be to use --hostname when --network is not a container?

mviereck commented 2 years ago

See the Docker run reference:

Oh, I should have looked there before. I did not imagine that this could have such a major impact.

So, given that, perhaps the fix here could be to use --hostname when --network is not a container?

That's a good idea! However, I think I won't mess with --hostname anymore, since the use case was quite minor.

SimplicityGuy commented 2 years ago

No worries, mate. Bugs happen. Appreciate the quick turnaround on this. The docker commands are all over the place. Mutually exclusive flags galore. Wait until you try using --filter on docker volumes... oh boy.