how to connect two docker container with host UDP portHow is Docker different from a virtual machine?How to list containers in DockerHow to get a Docker container's IP address from the host?How to remove old Docker containersCopying files from Docker container to hostCopying files from host to Docker containerHow to copy Docker images from one host to another without using a repositoryFrom inside of a Docker container, how do I connect to the localhost of the machine?Redirect same port of two Docker containers on different portsConnect a websocket client in a docker container to a websocket server in host

What is the definition of Product

What is "latex-dev"?

How to check status of Wi-Fi adapter through command line?

How can I portray a character with no fear of death, without them sounding utterly bored?

Are there any writings by blinded and/or exiled Byzantine emperors?

How does Harry wear the invisibility cloak?

Would a corpse look different on an interstellar spaceship?

How to fit Schwalbe Marathon Plus 28-622 on 622-16 rim

Initializing a std::array with a constant value

How to run a command 1 out of N times in Bash

Why does this regexpatch command only work once, not twice?

Playing boules... IN SPACE!

What can prevent a super elevator to a space station from being invented?

Can a country avoid prosecution for crimes against humanity by denying it happened?

Calculate Landau's function

What is the significance of 104%

Lumix G7: Raw photos only in 1920x1440, no higher res available

Is the mnemonic in Winter's Tale real?

How Total raw is calculated for Science pack 2?

Why wasn't Linda Hamilton in T3?

One hour 10 min layover in Newark; International -> Domestic connection. Enough time to clear customs?

In mathematics is there a substitution that is "different" from Vieta's substitution to solve the cubic equation?

Is mathematics truth?

Meaning of "educating the ice"



how to connect two docker container with host UDP port


How is Docker different from a virtual machine?How to list containers in DockerHow to get a Docker container's IP address from the host?How to remove old Docker containersCopying files from Docker container to hostCopying files from host to Docker containerHow to copy Docker images from one host to another without using a repositoryFrom inside of a Docker container, how do I connect to the localhost of the machine?Redirect same port of two Docker containers on different portsConnect a websocket client in a docker container to a websocket server in host






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















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









share|improve this question
































    0















    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









    share|improve this question




























      0












      0








      0








      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









      share|improve this question
















      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






      docker






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 28 at 6:18









      Berkhan Berkdemir

      3063 silver badges14 bronze badges




      3063 silver badges14 bronze badges










      asked Mar 28 at 1:51









      Amandeepsinghsaini .gmail.comAmandeepsinghsaini .gmail.com

      277 bronze badges




      277 bronze badges

























          4 Answers
          4






          active

          oldest

          votes


















          0















          You have to switch the ports because first port defines your local interface and the second one defines your container port.



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





          share|improve this answer

























          • I am receiving the data at port 1234 in host machine. if i tried to listen to 5000 the I will not receive ant data.

            – Amandeepsinghsaini .gmail.com
            Mar 28 at 17:12











          • You cannot listen the same port in the same network; however, you can use load balancer.

            – Berkhan Berkdemir
            Mar 28 at 23:04


















          0















          You can not listen the same UDP port on one host.
          So in second container, let use another port, eg: 1235



          docker run --rm -p 1235:5000/udp -it ffmpeg2


          Or in one host. You can call directly from container by creating network

          1) Create new network:



          $ docker network create ffmpeg



          2) Connect containers to network



          $ docker run --rm --name=ffmpeg --net=ffmpeg -it ffmpeg
          $ docker run --rm --name=ffmpeg2 --net=ffmpeg -it ffmpeg


          3) Now you can call directly from container by container name ffmpeg, ffmpeg2






          share|improve this answer



























          • FFMpeg uses UDP 1234 as a default port, so I think that the guy was trying to use different port, but also, doesn't want to change the default UDP port value

            – Berkhan Berkdemir
            Mar 28 at 2:00











          • if I used the different host port as you said 1235 then how i will get the data which is present at host port 1234.

            – Amandeepsinghsaini .gmail.com
            Mar 28 at 17:38












          • if you choose port 1235 you can use this port to get the data

            – nhancao
            Mar 29 at 1:34


















          0















          You can bind to different IPs on host machine, if multiple network cards are available on your host machine.






          share|improve this answer

























          • i have only one network card.

            – Amandeepsinghsaini .gmail.com
            Mar 28 at 17:12


















          0















          1) if the data is broadcasting UDP, binds to different ip:same_port, you can sign different ip to the same network card.
          2) use a port duplicating method on host, i.e., port 1234 -> 1235






          share|improve this answer



























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55389034%2fhow-to-connect-two-docker-container-with-host-udp-port%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            4 Answers
            4






            active

            oldest

            votes








            4 Answers
            4






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0















            You have to switch the ports because first port defines your local interface and the second one defines your container port.



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





            share|improve this answer

























            • I am receiving the data at port 1234 in host machine. if i tried to listen to 5000 the I will not receive ant data.

              – Amandeepsinghsaini .gmail.com
              Mar 28 at 17:12











            • You cannot listen the same port in the same network; however, you can use load balancer.

              – Berkhan Berkdemir
              Mar 28 at 23:04















            0















            You have to switch the ports because first port defines your local interface and the second one defines your container port.



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





            share|improve this answer

























            • I am receiving the data at port 1234 in host machine. if i tried to listen to 5000 the I will not receive ant data.

              – Amandeepsinghsaini .gmail.com
              Mar 28 at 17:12











            • You cannot listen the same port in the same network; however, you can use load balancer.

              – Berkhan Berkdemir
              Mar 28 at 23:04













            0














            0










            0









            You have to switch the ports because first port defines your local interface and the second one defines your container port.



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





            share|improve this answer













            You have to switch the ports because first port defines your local interface and the second one defines your container port.



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






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 28 at 1:58









            Berkhan BerkdemirBerkhan Berkdemir

            3063 silver badges14 bronze badges




            3063 silver badges14 bronze badges















            • I am receiving the data at port 1234 in host machine. if i tried to listen to 5000 the I will not receive ant data.

              – Amandeepsinghsaini .gmail.com
              Mar 28 at 17:12











            • You cannot listen the same port in the same network; however, you can use load balancer.

              – Berkhan Berkdemir
              Mar 28 at 23:04

















            • I am receiving the data at port 1234 in host machine. if i tried to listen to 5000 the I will not receive ant data.

              – Amandeepsinghsaini .gmail.com
              Mar 28 at 17:12











            • You cannot listen the same port in the same network; however, you can use load balancer.

              – Berkhan Berkdemir
              Mar 28 at 23:04
















            I am receiving the data at port 1234 in host machine. if i tried to listen to 5000 the I will not receive ant data.

            – Amandeepsinghsaini .gmail.com
            Mar 28 at 17:12





            I am receiving the data at port 1234 in host machine. if i tried to listen to 5000 the I will not receive ant data.

            – Amandeepsinghsaini .gmail.com
            Mar 28 at 17:12













            You cannot listen the same port in the same network; however, you can use load balancer.

            – Berkhan Berkdemir
            Mar 28 at 23:04





            You cannot listen the same port in the same network; however, you can use load balancer.

            – Berkhan Berkdemir
            Mar 28 at 23:04













            0















            You can not listen the same UDP port on one host.
            So in second container, let use another port, eg: 1235



            docker run --rm -p 1235:5000/udp -it ffmpeg2


            Or in one host. You can call directly from container by creating network

            1) Create new network:



            $ docker network create ffmpeg



            2) Connect containers to network



            $ docker run --rm --name=ffmpeg --net=ffmpeg -it ffmpeg
            $ docker run --rm --name=ffmpeg2 --net=ffmpeg -it ffmpeg


            3) Now you can call directly from container by container name ffmpeg, ffmpeg2






            share|improve this answer



























            • FFMpeg uses UDP 1234 as a default port, so I think that the guy was trying to use different port, but also, doesn't want to change the default UDP port value

              – Berkhan Berkdemir
              Mar 28 at 2:00











            • if I used the different host port as you said 1235 then how i will get the data which is present at host port 1234.

              – Amandeepsinghsaini .gmail.com
              Mar 28 at 17:38












            • if you choose port 1235 you can use this port to get the data

              – nhancao
              Mar 29 at 1:34















            0















            You can not listen the same UDP port on one host.
            So in second container, let use another port, eg: 1235



            docker run --rm -p 1235:5000/udp -it ffmpeg2


            Or in one host. You can call directly from container by creating network

            1) Create new network:



            $ docker network create ffmpeg



            2) Connect containers to network



            $ docker run --rm --name=ffmpeg --net=ffmpeg -it ffmpeg
            $ docker run --rm --name=ffmpeg2 --net=ffmpeg -it ffmpeg


            3) Now you can call directly from container by container name ffmpeg, ffmpeg2






            share|improve this answer



























            • FFMpeg uses UDP 1234 as a default port, so I think that the guy was trying to use different port, but also, doesn't want to change the default UDP port value

              – Berkhan Berkdemir
              Mar 28 at 2:00











            • if I used the different host port as you said 1235 then how i will get the data which is present at host port 1234.

              – Amandeepsinghsaini .gmail.com
              Mar 28 at 17:38












            • if you choose port 1235 you can use this port to get the data

              – nhancao
              Mar 29 at 1:34













            0














            0










            0









            You can not listen the same UDP port on one host.
            So in second container, let use another port, eg: 1235



            docker run --rm -p 1235:5000/udp -it ffmpeg2


            Or in one host. You can call directly from container by creating network

            1) Create new network:



            $ docker network create ffmpeg



            2) Connect containers to network



            $ docker run --rm --name=ffmpeg --net=ffmpeg -it ffmpeg
            $ docker run --rm --name=ffmpeg2 --net=ffmpeg -it ffmpeg


            3) Now you can call directly from container by container name ffmpeg, ffmpeg2






            share|improve this answer















            You can not listen the same UDP port on one host.
            So in second container, let use another port, eg: 1235



            docker run --rm -p 1235:5000/udp -it ffmpeg2


            Or in one host. You can call directly from container by creating network

            1) Create new network:



            $ docker network create ffmpeg



            2) Connect containers to network



            $ docker run --rm --name=ffmpeg --net=ffmpeg -it ffmpeg
            $ docker run --rm --name=ffmpeg2 --net=ffmpeg -it ffmpeg


            3) Now you can call directly from container by container name ffmpeg, ffmpeg2







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 28 at 2:06

























            answered Mar 28 at 1:58









            nhancaonhancao

            1211 silver badge3 bronze badges




            1211 silver badge3 bronze badges















            • FFMpeg uses UDP 1234 as a default port, so I think that the guy was trying to use different port, but also, doesn't want to change the default UDP port value

              – Berkhan Berkdemir
              Mar 28 at 2:00











            • if I used the different host port as you said 1235 then how i will get the data which is present at host port 1234.

              – Amandeepsinghsaini .gmail.com
              Mar 28 at 17:38












            • if you choose port 1235 you can use this port to get the data

              – nhancao
              Mar 29 at 1:34

















            • FFMpeg uses UDP 1234 as a default port, so I think that the guy was trying to use different port, but also, doesn't want to change the default UDP port value

              – Berkhan Berkdemir
              Mar 28 at 2:00











            • if I used the different host port as you said 1235 then how i will get the data which is present at host port 1234.

              – Amandeepsinghsaini .gmail.com
              Mar 28 at 17:38












            • if you choose port 1235 you can use this port to get the data

              – nhancao
              Mar 29 at 1:34
















            FFMpeg uses UDP 1234 as a default port, so I think that the guy was trying to use different port, but also, doesn't want to change the default UDP port value

            – Berkhan Berkdemir
            Mar 28 at 2:00





            FFMpeg uses UDP 1234 as a default port, so I think that the guy was trying to use different port, but also, doesn't want to change the default UDP port value

            – Berkhan Berkdemir
            Mar 28 at 2:00













            if I used the different host port as you said 1235 then how i will get the data which is present at host port 1234.

            – Amandeepsinghsaini .gmail.com
            Mar 28 at 17:38






            if I used the different host port as you said 1235 then how i will get the data which is present at host port 1234.

            – Amandeepsinghsaini .gmail.com
            Mar 28 at 17:38














            if you choose port 1235 you can use this port to get the data

            – nhancao
            Mar 29 at 1:34





            if you choose port 1235 you can use this port to get the data

            – nhancao
            Mar 29 at 1:34











            0















            You can bind to different IPs on host machine, if multiple network cards are available on your host machine.






            share|improve this answer

























            • i have only one network card.

              – Amandeepsinghsaini .gmail.com
              Mar 28 at 17:12















            0















            You can bind to different IPs on host machine, if multiple network cards are available on your host machine.






            share|improve this answer

























            • i have only one network card.

              – Amandeepsinghsaini .gmail.com
              Mar 28 at 17:12













            0














            0










            0









            You can bind to different IPs on host machine, if multiple network cards are available on your host machine.






            share|improve this answer













            You can bind to different IPs on host machine, if multiple network cards are available on your host machine.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 28 at 8:02









            Akash SharmaAkash Sharma

            4542 silver badges6 bronze badges




            4542 silver badges6 bronze badges















            • i have only one network card.

              – Amandeepsinghsaini .gmail.com
              Mar 28 at 17:12

















            • i have only one network card.

              – Amandeepsinghsaini .gmail.com
              Mar 28 at 17:12
















            i have only one network card.

            – Amandeepsinghsaini .gmail.com
            Mar 28 at 17:12





            i have only one network card.

            – Amandeepsinghsaini .gmail.com
            Mar 28 at 17:12











            0















            1) if the data is broadcasting UDP, binds to different ip:same_port, you can sign different ip to the same network card.
            2) use a port duplicating method on host, i.e., port 1234 -> 1235






            share|improve this answer





























              0















              1) if the data is broadcasting UDP, binds to different ip:same_port, you can sign different ip to the same network card.
              2) use a port duplicating method on host, i.e., port 1234 -> 1235






              share|improve this answer



























                0














                0










                0









                1) if the data is broadcasting UDP, binds to different ip:same_port, you can sign different ip to the same network card.
                2) use a port duplicating method on host, i.e., port 1234 -> 1235






                share|improve this answer













                1) if the data is broadcasting UDP, binds to different ip:same_port, you can sign different ip to the same network card.
                2) use a port duplicating method on host, i.e., port 1234 -> 1235







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jul 3 at 10:24









                bianbianbianbian

                3662 silver badges2 bronze badges




                3662 silver badges2 bronze badges






























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid …


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55389034%2fhow-to-connect-two-docker-container-with-host-udp-port%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

                    Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?