I had to modify the entrypoint script because it doesn't allow for setting the default port. Obviously for most project and most cases the default port of 5672 is perfect. However the project I'm working on requires the use of a custom and random port. In this particular instance I'm running rabbit on a CI env which allocates random ports to defined ENV vars. I hope that explains the context around the requirement for needing some customization on the ports.
Would you be open to a PR to change this code?
To something like this?
: ${RABBITMQ_NODE_PORT:="5672"}
rabbit_set_config 'listeners.tcp.default' "$RABBITMQ_NODE_PORT"
See #422 / https://github.com/docker-library/rabbitmq/pull/424 -- we are much more likely to remove behavior from the entrypoint script than add to it.
What I would suggest is supplying your own configuration snippet that enables the port you desire (rather than relying on the snippet our script currently generates).
Oh ok. After taking a second look, I see where I could have done things differently. In short, I can avoid relying on the entrypoint script by adding COPY rabbitmq.conf /etc/rabbitmq/rabbitmq.conf to my dockerfile. Where the rabbitmq.conf file has the contents of
loopback_users.guest = false
management.tcp.port = 15672
Specifically the file does not have listeners.tcp.default = 5672. Which allows the RABBITMQ_NODE_PORT env var to decide the port.
I think initially (it was about a month ago) I thought that I couldn't modify with rabbitmq.conf without breaking the entrypoint script.
Thank you for responding to my request. I very much appreciate all the hard work. 馃
Most helpful comment
Oh ok. After taking a second look, I see where I could have done things differently. In short, I can avoid relying on the entrypoint script by adding
COPY rabbitmq.conf /etc/rabbitmq/rabbitmq.confto my dockerfile. Where therabbitmq.conffile has the contents ofSpecifically the file does not have
listeners.tcp.default = 5672. Which allows theRABBITMQ_NODE_PORTenv var to decide the port.I think initially (it was about a month ago) I thought that I couldn't modify with
rabbitmq.confwithout breaking the entrypoint script.Thank you for responding to my request. I very much appreciate all the hard work. 馃