Please-Explain
Please-Explain

Reputation: 11

Listen and broadcast/multicast UDP message through docker container

I have a docker container which host a software how need to listen message from a specific port and want to broadcast/multicast a message through my network.

This network is not internal to my docker. And my software works totally fine outside of my container.

The problem is that i can't find any solution to in the same time broadcast a message and listen in the same time.

My docker daemon is working on windows and my container are on linux.

Here is the docker-compose.yml I use :

name: solution

services:
  udpserver:
    container_name: udpserver
    env_file: ./udpserver/.env.example
    build:
      context: .
      dockerfile: ./udpserver/udpserver.dockerfile
    volumes:
      - ./udpserver/src:/app/udpserver/src
      - ./excuriolibrary:/app/excuriolibrary
    command: pnpm run dev
    ports:
      - '5566:5566/udp'
    # network_mode: host ## not working in my case as i can't listen port 5566 if this type of network is ON

This solution permit me to listen to messages on 5566 but I can not broadcast outside of my docker.

With the network_mode: host enable I can broadcast but I am no longer capable of listenning messages on 5566

I read that MACVLAN could maybe fix my solution but it may not work on windows and I'm having trouble to configure it.

Do someone know a solution for my problem ?

Upvotes: 0

Views: 41

Answers (0)

Related Questions