I was thinking in a way of using RabbitMQ on a Docker container as part of an automatic integration tests for a application I was working with at my current job. That is easy, the Docker Hub has an official Docker image ready for use as rabbitmq:management-alpine.
My first thought was to automate the configuration of the RabbitMQ by using rabbitmqctl or rabbitmqadmin programs, but then I remembered that RabbitMQ can actually use a exported configuration backup in the form of a JSON file.
The problem was: how to load this configuration? I can't change the Dockerfile in order to do that because the broker must be running in order to load the configuration but then I would need to override the ENTRYPOINT, something that I was not willing to do.
Fortunately a good soul had already implemented a clever hack to the container configuration as you want, without doing many changes in the original Dockerfile.
So, at the end, the only thing I need to do is to write a Dockefile like the one below:
COPY rabbit_config.json /etc/rabbitmq/definitions.json