Unable to Establish Multicast with --net=host When Using ROS 2 Foxy

I am running Docker Desktop v26.1.1 for Linux. My OS is Ubuntu 22.04. I am trying to use establish communication between a Docker container running ROS 2 Foxy on my PC and a robot running Foxy locally on Ubuntu 18.04. The PC and drone are on the same WLAN. My host PC is running ROS 2 Humble, which is a newer version of ROS 2 than Foxy, which cannot run on Ubuntu 22.04. ROS 2 Humble is not needed for the project, but I’m finding it useful for troubleshooting purposes.

I am using a custom Docker image for this project, which is based on the OSRF Foxy image. The same issue occurs on the unmodified OSRF image. It’s being run with --net=host. When I use the commands ros2 multicast receive inside the container and ros2 multicast send on the drone or vice versa, the message isn’t received and it’s also not received when I do the same thing between the container and host PC. The drone and host PC can communicate using these ros2 multicast commands. However, the container and host PC can establish connectivity by creating an iperf server and client and the container can ping the drone. The drone and host PC can also ping each other.

I am unsure what is causing the Docker container to be unable to send or receive multicast messages (specifically ros2 multicast messages) when it can still ping on the network and communicate with an iperf server with a multicast address. I have tried using --pid=host when launching the container but this did not have an effect.