Unable to connect to Rabbit MQ instance when running from docker container built by dockerfile












0















We are attempting to put an instance of rabbit mq into our Kubernetes environment. To do so, we have to implement it into our build and release process, which includes creating a docker container by Dockerfile.



During our original testing, we created the docker container manually with the following commands, and it worked correctly:



docker pull rabbitmq
docker run -p 5672:5672 -d --hostname my-rabbit --name some-rabbit rabbitmq:3
docker start some-rabbit


To create our docker file, we have tried various iterations, with the latest being:



FROM rabbitmq:3 AS rabbitmq
RUN rabbitmq-server -p 5672:5672 -d --hostname my-rabbit --name some-rabbit
EXPOSE 5672


We have also tried it with just the Run rabbitmq-server and not the additional parameters.



This does create a rabbit mq instance that we are able to ssh into and verify it is running, but when we try to connect to it, we receive an error: "ExtendedSocketException: An attempt was made to access a socket in a way forbidden by its access permission" (we are using rabbit's default of 5672).



I'm not sure what the differences could be between what we've done in the command line and what has been done in the Dockerfile.










share|improve this question





























    0















    We are attempting to put an instance of rabbit mq into our Kubernetes environment. To do so, we have to implement it into our build and release process, which includes creating a docker container by Dockerfile.



    During our original testing, we created the docker container manually with the following commands, and it worked correctly:



    docker pull rabbitmq
    docker run -p 5672:5672 -d --hostname my-rabbit --name some-rabbit rabbitmq:3
    docker start some-rabbit


    To create our docker file, we have tried various iterations, with the latest being:



    FROM rabbitmq:3 AS rabbitmq
    RUN rabbitmq-server -p 5672:5672 -d --hostname my-rabbit --name some-rabbit
    EXPOSE 5672


    We have also tried it with just the Run rabbitmq-server and not the additional parameters.



    This does create a rabbit mq instance that we are able to ssh into and verify it is running, but when we try to connect to it, we receive an error: "ExtendedSocketException: An attempt was made to access a socket in a way forbidden by its access permission" (we are using rabbit's default of 5672).



    I'm not sure what the differences could be between what we've done in the command line and what has been done in the Dockerfile.










    share|improve this question



























      0












      0








      0








      We are attempting to put an instance of rabbit mq into our Kubernetes environment. To do so, we have to implement it into our build and release process, which includes creating a docker container by Dockerfile.



      During our original testing, we created the docker container manually with the following commands, and it worked correctly:



      docker pull rabbitmq
      docker run -p 5672:5672 -d --hostname my-rabbit --name some-rabbit rabbitmq:3
      docker start some-rabbit


      To create our docker file, we have tried various iterations, with the latest being:



      FROM rabbitmq:3 AS rabbitmq
      RUN rabbitmq-server -p 5672:5672 -d --hostname my-rabbit --name some-rabbit
      EXPOSE 5672


      We have also tried it with just the Run rabbitmq-server and not the additional parameters.



      This does create a rabbit mq instance that we are able to ssh into and verify it is running, but when we try to connect to it, we receive an error: "ExtendedSocketException: An attempt was made to access a socket in a way forbidden by its access permission" (we are using rabbit's default of 5672).



      I'm not sure what the differences could be between what we've done in the command line and what has been done in the Dockerfile.










      share|improve this question
















      We are attempting to put an instance of rabbit mq into our Kubernetes environment. To do so, we have to implement it into our build and release process, which includes creating a docker container by Dockerfile.



      During our original testing, we created the docker container manually with the following commands, and it worked correctly:



      docker pull rabbitmq
      docker run -p 5672:5672 -d --hostname my-rabbit --name some-rabbit rabbitmq:3
      docker start some-rabbit


      To create our docker file, we have tried various iterations, with the latest being:



      FROM rabbitmq:3 AS rabbitmq
      RUN rabbitmq-server -p 5672:5672 -d --hostname my-rabbit --name some-rabbit
      EXPOSE 5672


      We have also tried it with just the Run rabbitmq-server and not the additional parameters.



      This does create a rabbit mq instance that we are able to ssh into and verify it is running, but when we try to connect to it, we receive an error: "ExtendedSocketException: An attempt was made to access a socket in a way forbidden by its access permission" (we are using rabbit's default of 5672).



      I'm not sure what the differences could be between what we've done in the command line and what has been done in the Dockerfile.







      docker kubernetes rabbitmq






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 '18 at 22:58









      Rico

      28.1k94966




      28.1k94966










      asked Nov 21 '18 at 22:11









      Marshall TigerusMarshall Tigerus

      2,39662347




      2,39662347
























          2 Answers
          2






          active

          oldest

          votes


















          1














          Looks like you need to expose quite a few other ports.



          I was able to generate the Dockerfile commands for rabbitmq:latest (rabbitmq:3 looks the same) using this:



          ENV PATH=/usr/lib/rabbitmq/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin    
          ENV GOSU_VERSION=1.10
          ENV RABBITMQ_LOGS=-
          ENV RABBITMQ_SASL_LOGS=-
          ENV RABBITMQ_GPG_KEY=0A9AF2115F4687BD29803A206B73A36E6026DFCA
          ENV RABBITMQ_VERSION=3.7.8
          ENV RABBITMQ_GITHUB_TAG=v3.7.8
          ENV RABBITMQ_DEBIAN_VERSION=3.7.8-1
          ENV LANG=C.UTF-8
          ENV HOME=/var/lib/rabbitmq
          EXPOSE 25672/tcp
          EXPOSE 4369/tcp
          EXPOSE 5671/tcp
          EXPOSE 5672/tcp
          VOLUME /var/lib/rabbitmq
          ENTRYPOINT ["docker-entrypoint.sh"]
          CMD ["rabbitmq-server"]





          share|improve this answer































            0














            Dockerfile is used to build your own image, not to run a container. The question is - why do you need to build your own rabbitmq image? If you don't - then just use the official rabbitmq image (as you originally did).
            I'm sure it already has all the necessary EXPOSE directives built-in
            Also note command line arguments "-p 5672:5672 -d --hostname my-rabbit --name some-rabbit rabbitmq:3" are passed to docker daemon, not to the rabbitmq process.
            If you want to make sure you're forwarding all the necessary ports - just run it with -P.






            share|improve this answer
























            • our build process currently requires a dockerfile. Are you saying we could literally just have a dockerfile that was just FROM rabbitmq:3 AS rabbitmq

              – Marshall Tigerus
              Nov 26 '18 at 20:01











            • yes, this would work but it makes no sense - why repackage an existing image? you don't actually need to build your own image - just create a deployment based on rabbitmq. Also I heartily recommend you not to use just 'rabbitmq', which implies the 'latest' tag, but work with a specific version. this way you you can be sure all your deployments are identical.

              – antweiss
              Nov 27 '18 at 10:57











            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%2f53421160%2funable-to-connect-to-rabbit-mq-instance-when-running-from-docker-container-built%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Looks like you need to expose quite a few other ports.



            I was able to generate the Dockerfile commands for rabbitmq:latest (rabbitmq:3 looks the same) using this:



            ENV PATH=/usr/lib/rabbitmq/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin    
            ENV GOSU_VERSION=1.10
            ENV RABBITMQ_LOGS=-
            ENV RABBITMQ_SASL_LOGS=-
            ENV RABBITMQ_GPG_KEY=0A9AF2115F4687BD29803A206B73A36E6026DFCA
            ENV RABBITMQ_VERSION=3.7.8
            ENV RABBITMQ_GITHUB_TAG=v3.7.8
            ENV RABBITMQ_DEBIAN_VERSION=3.7.8-1
            ENV LANG=C.UTF-8
            ENV HOME=/var/lib/rabbitmq
            EXPOSE 25672/tcp
            EXPOSE 4369/tcp
            EXPOSE 5671/tcp
            EXPOSE 5672/tcp
            VOLUME /var/lib/rabbitmq
            ENTRYPOINT ["docker-entrypoint.sh"]
            CMD ["rabbitmq-server"]





            share|improve this answer




























              1














              Looks like you need to expose quite a few other ports.



              I was able to generate the Dockerfile commands for rabbitmq:latest (rabbitmq:3 looks the same) using this:



              ENV PATH=/usr/lib/rabbitmq/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin    
              ENV GOSU_VERSION=1.10
              ENV RABBITMQ_LOGS=-
              ENV RABBITMQ_SASL_LOGS=-
              ENV RABBITMQ_GPG_KEY=0A9AF2115F4687BD29803A206B73A36E6026DFCA
              ENV RABBITMQ_VERSION=3.7.8
              ENV RABBITMQ_GITHUB_TAG=v3.7.8
              ENV RABBITMQ_DEBIAN_VERSION=3.7.8-1
              ENV LANG=C.UTF-8
              ENV HOME=/var/lib/rabbitmq
              EXPOSE 25672/tcp
              EXPOSE 4369/tcp
              EXPOSE 5671/tcp
              EXPOSE 5672/tcp
              VOLUME /var/lib/rabbitmq
              ENTRYPOINT ["docker-entrypoint.sh"]
              CMD ["rabbitmq-server"]





              share|improve this answer


























                1












                1








                1







                Looks like you need to expose quite a few other ports.



                I was able to generate the Dockerfile commands for rabbitmq:latest (rabbitmq:3 looks the same) using this:



                ENV PATH=/usr/lib/rabbitmq/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin    
                ENV GOSU_VERSION=1.10
                ENV RABBITMQ_LOGS=-
                ENV RABBITMQ_SASL_LOGS=-
                ENV RABBITMQ_GPG_KEY=0A9AF2115F4687BD29803A206B73A36E6026DFCA
                ENV RABBITMQ_VERSION=3.7.8
                ENV RABBITMQ_GITHUB_TAG=v3.7.8
                ENV RABBITMQ_DEBIAN_VERSION=3.7.8-1
                ENV LANG=C.UTF-8
                ENV HOME=/var/lib/rabbitmq
                EXPOSE 25672/tcp
                EXPOSE 4369/tcp
                EXPOSE 5671/tcp
                EXPOSE 5672/tcp
                VOLUME /var/lib/rabbitmq
                ENTRYPOINT ["docker-entrypoint.sh"]
                CMD ["rabbitmq-server"]





                share|improve this answer













                Looks like you need to expose quite a few other ports.



                I was able to generate the Dockerfile commands for rabbitmq:latest (rabbitmq:3 looks the same) using this:



                ENV PATH=/usr/lib/rabbitmq/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin    
                ENV GOSU_VERSION=1.10
                ENV RABBITMQ_LOGS=-
                ENV RABBITMQ_SASL_LOGS=-
                ENV RABBITMQ_GPG_KEY=0A9AF2115F4687BD29803A206B73A36E6026DFCA
                ENV RABBITMQ_VERSION=3.7.8
                ENV RABBITMQ_GITHUB_TAG=v3.7.8
                ENV RABBITMQ_DEBIAN_VERSION=3.7.8-1
                ENV LANG=C.UTF-8
                ENV HOME=/var/lib/rabbitmq
                EXPOSE 25672/tcp
                EXPOSE 4369/tcp
                EXPOSE 5671/tcp
                EXPOSE 5672/tcp
                VOLUME /var/lib/rabbitmq
                ENTRYPOINT ["docker-entrypoint.sh"]
                CMD ["rabbitmq-server"]






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 21 '18 at 23:12









                RicoRico

                28.1k94966




                28.1k94966

























                    0














                    Dockerfile is used to build your own image, not to run a container. The question is - why do you need to build your own rabbitmq image? If you don't - then just use the official rabbitmq image (as you originally did).
                    I'm sure it already has all the necessary EXPOSE directives built-in
                    Also note command line arguments "-p 5672:5672 -d --hostname my-rabbit --name some-rabbit rabbitmq:3" are passed to docker daemon, not to the rabbitmq process.
                    If you want to make sure you're forwarding all the necessary ports - just run it with -P.






                    share|improve this answer
























                    • our build process currently requires a dockerfile. Are you saying we could literally just have a dockerfile that was just FROM rabbitmq:3 AS rabbitmq

                      – Marshall Tigerus
                      Nov 26 '18 at 20:01











                    • yes, this would work but it makes no sense - why repackage an existing image? you don't actually need to build your own image - just create a deployment based on rabbitmq. Also I heartily recommend you not to use just 'rabbitmq', which implies the 'latest' tag, but work with a specific version. this way you you can be sure all your deployments are identical.

                      – antweiss
                      Nov 27 '18 at 10:57
















                    0














                    Dockerfile is used to build your own image, not to run a container. The question is - why do you need to build your own rabbitmq image? If you don't - then just use the official rabbitmq image (as you originally did).
                    I'm sure it already has all the necessary EXPOSE directives built-in
                    Also note command line arguments "-p 5672:5672 -d --hostname my-rabbit --name some-rabbit rabbitmq:3" are passed to docker daemon, not to the rabbitmq process.
                    If you want to make sure you're forwarding all the necessary ports - just run it with -P.






                    share|improve this answer
























                    • our build process currently requires a dockerfile. Are you saying we could literally just have a dockerfile that was just FROM rabbitmq:3 AS rabbitmq

                      – Marshall Tigerus
                      Nov 26 '18 at 20:01











                    • yes, this would work but it makes no sense - why repackage an existing image? you don't actually need to build your own image - just create a deployment based on rabbitmq. Also I heartily recommend you not to use just 'rabbitmq', which implies the 'latest' tag, but work with a specific version. this way you you can be sure all your deployments are identical.

                      – antweiss
                      Nov 27 '18 at 10:57














                    0












                    0








                    0







                    Dockerfile is used to build your own image, not to run a container. The question is - why do you need to build your own rabbitmq image? If you don't - then just use the official rabbitmq image (as you originally did).
                    I'm sure it already has all the necessary EXPOSE directives built-in
                    Also note command line arguments "-p 5672:5672 -d --hostname my-rabbit --name some-rabbit rabbitmq:3" are passed to docker daemon, not to the rabbitmq process.
                    If you want to make sure you're forwarding all the necessary ports - just run it with -P.






                    share|improve this answer













                    Dockerfile is used to build your own image, not to run a container. The question is - why do you need to build your own rabbitmq image? If you don't - then just use the official rabbitmq image (as you originally did).
                    I'm sure it already has all the necessary EXPOSE directives built-in
                    Also note command line arguments "-p 5672:5672 -d --hostname my-rabbit --name some-rabbit rabbitmq:3" are passed to docker daemon, not to the rabbitmq process.
                    If you want to make sure you're forwarding all the necessary ports - just run it with -P.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 22 '18 at 13:52









                    antweissantweiss

                    1,869187




                    1,869187













                    • our build process currently requires a dockerfile. Are you saying we could literally just have a dockerfile that was just FROM rabbitmq:3 AS rabbitmq

                      – Marshall Tigerus
                      Nov 26 '18 at 20:01











                    • yes, this would work but it makes no sense - why repackage an existing image? you don't actually need to build your own image - just create a deployment based on rabbitmq. Also I heartily recommend you not to use just 'rabbitmq', which implies the 'latest' tag, but work with a specific version. this way you you can be sure all your deployments are identical.

                      – antweiss
                      Nov 27 '18 at 10:57



















                    • our build process currently requires a dockerfile. Are you saying we could literally just have a dockerfile that was just FROM rabbitmq:3 AS rabbitmq

                      – Marshall Tigerus
                      Nov 26 '18 at 20:01











                    • yes, this would work but it makes no sense - why repackage an existing image? you don't actually need to build your own image - just create a deployment based on rabbitmq. Also I heartily recommend you not to use just 'rabbitmq', which implies the 'latest' tag, but work with a specific version. this way you you can be sure all your deployments are identical.

                      – antweiss
                      Nov 27 '18 at 10:57

















                    our build process currently requires a dockerfile. Are you saying we could literally just have a dockerfile that was just FROM rabbitmq:3 AS rabbitmq

                    – Marshall Tigerus
                    Nov 26 '18 at 20:01





                    our build process currently requires a dockerfile. Are you saying we could literally just have a dockerfile that was just FROM rabbitmq:3 AS rabbitmq

                    – Marshall Tigerus
                    Nov 26 '18 at 20:01













                    yes, this would work but it makes no sense - why repackage an existing image? you don't actually need to build your own image - just create a deployment based on rabbitmq. Also I heartily recommend you not to use just 'rabbitmq', which implies the 'latest' tag, but work with a specific version. this way you you can be sure all your deployments are identical.

                    – antweiss
                    Nov 27 '18 at 10:57





                    yes, this would work but it makes no sense - why repackage an existing image? you don't actually need to build your own image - just create a deployment based on rabbitmq. Also I heartily recommend you not to use just 'rabbitmq', which implies the 'latest' tag, but work with a specific version. this way you you can be sure all your deployments are identical.

                    – antweiss
                    Nov 27 '18 at 10:57


















                    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%2f53421160%2funable-to-connect-to-rabbit-mq-instance-when-running-from-docker-container-built%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

                    Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

                    ts Property 'filter' does not exist on type '{}'

                    mat-slide-toggle shouldn't change it's state when I click cancel in confirmation window