-
Notifications
You must be signed in to change notification settings - Fork 430
Setting RABBITMQ_NODE_PORT doesn't seem to effect #480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Because the entrypoint sets See also #449 and #251 (comment)
Supplying a config file works fine $ cat rabbitmq.conf
loopback_users.guest = false
listeners.tcp.default = 8989
management.tcp.port = 18989
$ docker run -d --name rabbit -v "$PWD"/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf rabbitmq:management
9d118692f50d8c374f22b38ea5a4fb4495bd97f69efc4b184fbfe729617377fb
$ docker logs rabbit 2>&1 | grep 8989
2021-04-19 16:10:41.365 [info] <0.794.0> Management plugin: HTTP (non-TLS) listener started on port 18989
2021-04-19 16:10:41.474 [info] <0.1032.0> started TCP listener on [::]:8989 I tried using So config file it is |
I have the same diagnosis but I have a dynamic use case where I deploy the image and then let it be configured on the fly. I can create and mount a config file on the fly but it is an unnecessary hassle. So, I decided to use bitnami's rabbitmq image until this settles. |
Hey @michaelklishin, I'm a little confused. This used to work in on Apr 20, 2018; which looks like it was $ docker run -it --rm -e RABBITMQ_NODE_PORT=6666 rabbitmq
...
2021-04-21 18:46:37.436 [info] <0.891.0> started TCP listener on [::]:5672 After some digging, it looks like the environment variable overrides the config file all the way until $ docker run -it --rm -e RABBITMQ_NODE_PORT=6666 --entrypoint rabbitmq-server --user rabbitmq rabbitmq:3.8.14 |
@yosifkit starting with You know my take on environment variables: they are terrible. No reason to use them when there's a |
I should also mention that "regular" users of RabbitMQ effectively never use both listener settings and This is fairly unique to Docker users and this image in particular. So we have to choose one or the other, and the general |
Ok, fair enough. Given that we currently generate the configuration that's overriding this, what do you think about this patch as a band-aid that hopefully won't live into the next release (if we can resolve #424? 🙏 three little questions in #424 (comment) 😇): diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index da789b9..c1ae587 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -365,10 +365,10 @@ if [ "$1" = 'rabbitmq-server' ] && [ "$shouldWriteConfig" ]; then
fi
if [ "$haveSslConfig" ]; then
- rabbit_set_config 'listeners.ssl.default' 5671
+ rabbit_set_config 'listeners.ssl.default' "${RABBITMQ_NODE_PORT:-5671}"
rabbit_env_config 'ssl' "${sslConfigKeys[@]}"
else
- rabbit_set_config 'listeners.tcp.default' 5672
+ rabbit_set_config 'listeners.tcp.default' "${RABBITMQ_NODE_PORT:-5672}"
fi
rabbit_env_config '' "${rabbitConfigKeys[@]}" Lines 367 to 372 in e62f193
|
@tianon that looks like a reasonable solution |
What do I want to achieve?
Make rabbitmq listen for amqp connections on a port other than default
5672
My constraints
I do not want to use a config file, I want to achieve this via environment variables
What did I try?
Same results when I try:
In my development environment, I use
docker-compose
withrabbitmq:alpine
image (13b87dec7346643343e297673c9ac6b80b68ddb8af70b3b34a55a8a4209ca2d2
)single docker container, with alpine image:
docker run -it --rm -e RABBITMQ_NODE_PORT=8989 rabbitmq:alpine
single docker container, with
rabbitmq
image (f83a0c22b15ab5f71a8fe2c2ff5366a78e967bf27298df181f161de04e4d8c9a
)docker run -it --rm -e RABBITMQ_NODE_PORT=8989 rabbitmq
Which versions did I use?
I tried it on two different machines.
Docker version 20.10.5, build 55c4c88
onLinux ubuntu 5.8.0-45-generic #51~20.04.1-Ubuntu SMP Tue Feb 23 13:46:31 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
and
Docker version 20.10.6, build 370c28948e
on
Linux 5.11.15-arch1-2 #1 SMP PREEMPT Sat, 17 Apr 2021 00:22:30 +0000 x86_64 GNU/Linux
What did I want to see?
Rabbitmq to use my port
What do I see?
The text was updated successfully, but these errors were encountered: