<p>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.</p>

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

<pre><code>docker pull rabbitmq
docker run -p 5672:5672 -d --hostname my-rabbit --name some-rabbit rabbitmq:3
docker start some-rabbit
</code></pre>

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

<pre><code>FROM rabbitmq:3 AS rabbitmq
RUN rabbitmq-server -p 5672:5672 -d --hostname my-rabbit --name some-rabbit 
EXPOSE 5672
</code></pre>

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

<p>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).</p>

<p>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.</p>

Marshall Tigerus
<p>Looks like you need to expose quite a few other ports.</p>

<p>I was able to generate the Dockerfile commands for <code>rabbitmq:latest</code> (<code>rabbitmq:3</code> looks the same) using <a href="https://stackoverflow.com/a/26768984/2989261">this</a>:</p>

<pre><code>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"]
</code></pre>
