Ec2 Instance running docker+ros2: unable to join

I am running a docker container on ec2 which runs ros2 humble and husarnet with cyclone dds. The container starts up fine, however it is never able to join the server, and therefore the listener node cannot receive any incoming data.

On ec2, I’ve opened up UDP ports 5582 - 5583 for ipv4 and ipv6, as well as TCP port 443 for ipv4/ipv6 communication inbound. All outbound udp/tcp communication is open as well.

What can I do to debug why the docker container cannot join the husarnet group? Do I need to remove specific firewalls/open up different ports? Do I need to just clear out docker/husarnet and startover?

When running locally within the ec2 container (and not also in the docker container), I can join the husarnet account with a device fine.

My docker compose file is:

version: '2.3'

            context: ../..
            dockerfile: my_container/robot_listener/Dockerfile

        command: ros2 launch emulator
        network_mode: service:husarnet

            husarnet: { condition: service_healthy }

        image: husarnet/husarnet
        restart: unless-stopped
            # This will persist your Husarnet Client keys, thus IP of the container will be stable/the same between (re)boots
            - /var/lib/husarnet
            # Husarnet is using IPv6 for the internal connections
            - net.ipv6.conf.all.disable_ipv6=0
            - NET_ADMIN
            - /dev/net/tun
            - HOSTNAME=robot-listener
            - HUSARNET_DEBUG=1

My cyclonedds config file is:

<?xml version="1.0" encoding="UTF-8" ?>
<CycloneDDS xmlns="" xmlns:xsi="" xsi:schemaLocation="">
    <Domain id="any">
            <MaxMessageSize>8388608B</MaxMessageSize> <!-- 8MB -->
            <FragmentSize>32000B</FragmentSize> <!-- 16KB -->
            <SocketReceiveBufferSize min="10MB"/>

It’s also worth noting that this docker container can communicate fine with the other ros2+docker+husarnet container when they’re both running locally with the same husarnet cyclonedds configuration file.

Hi @kobra

Try following command:

ufw allow in on hnet0 from fc94::/16

You may also need to add similar rule in ec2 firewall.

Make sure ports UDP 5582 and TCP 443 are open in ufw too, not just in ec2 firewall.

Regards, Filip