My docker-compose looks like this:
version: '3.2'
services:
mq:
hostname: ${HOST_NAME}
ports:
- "5671:5671"
- "5672:5672"
- "15671:15671"
- "15672:15672"
environment:
- RABBITMQ_DEFAULT_USER=${USER}
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS}
volumes:
- ${CACERT_PEM_FILE}:/etc/rabbitmq/certs/cacert.pem
- ${CERT_PEM_FILE}:/etc/rabbitmq/certs/cert.pem
- ${KEY_PEM_FILE}:/etc/rabbitmq/certs/key.pem
- ${MQ_CONFIG_FILE}:/etc/rabbitmq/rabbitmq.conf
image: rabbitmq:3-management
My rabbitmq.conf looks like this:
listeners.tcp.default = 5672
listeners.ssl.default = 5671
ssl_options.cacertfile = /etc/rabbitmq/certs/cacert.pem
ssl_options.certfile = /etc/rabbitmq/certs/cert.pem
ssl_options.keyfile = /etc/rabbitmq/certs/key.pem
ssl_options.verify = verify_peer
ssl_options.fail_if_no_peer_cert = false
ssl_options.versions.1 = tlsv1.2
ssl_options.versions.2 = tlsv1.1
However when I try to do docker-compose up
I get the following error:
cannot rename /etc/rabbitmq/sedMaHqMa: Device or resource busy
I tried using old format of config file (rabbitmq.config) and it was not giving me this error, however I need to use new format because I need the password to be provided by during the startup via env. variables.
EDIT Feb 20, 2018
Here is a list of currently available environmental variables in Rabbitmq docker image, and they are enough to setup TLS for both AMQP and HTTP (management API and Web Console)
Copying them in case the link will become broken:
RABBITMQ_DEFAULT_PASS
RABBITMQ_DEFAULT_USER
RABBITMQ_DEFAULT_VHOST
RABBITMQ_ERLANG_COOKIE
RABBITMQ_HIPE_COMPILE
RABBITMQ_MANAGEMENT_SSL_CACERTFILE
RABBITMQ_MANAGEMENT_SSL_CERTFILE
RABBITMQ_MANAGEMENT_SSL_DEPTH
RABBITMQ_MANAGEMENT_SSL_FAIL_IF_NO_PEER_CERT
RABBITMQ_MANAGEMENT_SSL_KEYFILE
RABBITMQ_MANAGEMENT_SSL_VERIFY
RABBITMQ_SSL_CACERTFILE
RABBITMQ_SSL_CERTFILE
RABBITMQ_SSL_DEPTH
RABBITMQ_SSL_FAIL_IF_NO_PEER_CERT
RABBITMQ_SSL_KEYFILE
RABBITMQ_SSL_VERIFY
RABBITMQ_VM_MEMORY_HIGH_WATERMARK
This seem to be an issue with current rabbitmq
Dockerfile. Particulary sed command seem not work properly on configfile mapped as volume. However as you have control over your rabbitmq.conf
anyway, why not include default user and password to this file
default_user = admin
default_pass = YourStrongPasswort
and remove RABBITMQ_DEFAULT_USER and RABBITMQ_DEFAULT_PASS out of your compose file. This is fastest work-around probably. Just tested, works for me (official rabbitmq:3.7-management).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With