Skip to content

rabbitmq-server overwrites config file #341

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

Closed
sp193 opened this issue Jun 2, 2019 · 3 comments
Closed

rabbitmq-server overwrites config file #341

sp193 opened this issue Jun 2, 2019 · 3 comments

Comments

@sp193
Copy link

sp193 commented Jun 2, 2019

Hi all,

I have started using the RabbitMQ 3.7.15 docker image, but I found that rabbitmq-server is overwriting my configuration file (/etc/rabbitmq/rabbitmq.conf) with its generated version.

This is similar to #191. But now in 2019, what is the modern way of setting other parameters, like the clustering peer discovery options?
cluster_formation.peer_discovery_backend = rabbit_peer_discovery_dns

Past solutions recommended avoiding the default docker-entrypoint.sh script and/or not defining any RABBITMQ environmental variables. I'm doing both, but my rabbitmq.conf file still gets overwritten by the default.

I'm avoiding the default entrypoint script by defining my own in dockerfile and have confirmed that the substitute script is being run instead, with docker ps. This replacement script currently runs rabbitmq-server directly.

I also did the following in my dockerfile, in an attempt to write-protect it:

RUN cp /tmp/rabbitmq.conf /etc/rabbitmq/ && chmod 444 /etc/rabbitmq/rabbitmq.conf && chown root:root /etc/rabbitmq/rabbitmq.conf

But then after the docker image has started, ls -l /etc/rabbitmq/rabbitmq.conf will show something like this:

-rw-r--r-- 1 rabbitmq rabbitmq 

Thanks in advance!

@michaelklishin
Copy link
Collaborator

RabbitMQ never overwrites a provided configuration file. rabbitmq.conf and advanced.config are never modified at all.

This image might but you need to provide more evidence than this.

@sp193
Copy link
Author

sp193 commented Jun 3, 2019

I don't know how else I can prove it. Neither can I bring back any code to show. Maybe we should just leave it like this. I have no resources to find the source of the generated config (otherwise I would not ask), but it has exactly the same values as the generated config file.

Thanks anyway.

@sp193 sp193 closed this as completed Jun 3, 2019
@tianon
Copy link
Member

tianon commented Jun 3, 2019

To avoid the image writing a configuration file, you'll want to avoid specifying any of the image-specific environment variables supported by the entrypoint and provide your own configuration file.

In your case, it looks like it's just the chown which is causing an issue for you, in which case I'd recommend adding --user/user: to your container parameters to specify explicitly which user you want to run the container as, thus bypassing even our chown behavior:

find /var/lib/rabbitmq \! -user rabbitmq -exec chown rabbitmq '{}' +

You should be able to choose any arbitrary UID as long as the storage you provide has appropriate permissions for that UID (and the configuration file you provide is readable by it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants