how to connect two docker container with host UDP port

  docker

I am running the two containers. Both containers want to listen the host machine’s UDP port. I am getting the data from host over UDP port 1234 and I want to run two containers which will listen the host over UDP port. I think two processes can listen the same UDP port.

I have created two container ffmpeg1 and ffmpeg2.

running first:

docker run --rm -p 1234:1234/udp -it ffmpeg
docker run --rm -p 1234:5000/udp -it ffmpeg2

getting the below error when tried to run second container.

docker: Error response from daemon: driver failed programming external connectivity on endpoint reverent_germain (9915c14466f78f3ae2215d9e53edc502a9b6fff81f08f05f52d79088): Bind for 0.0.0.0:1234 failed: port is already allocated.
ERRO[0000] error waiting for container: context canceled

Source: StackOverflow

LEAVE A COMMENT