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

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

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