File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,6 +47,18 @@ export RABBITMQ_MANAGEMENT_PORT="${RABBITMQ_MANAGEMENT_PORT:-15672}"
4747unset RABBITMQ_DEFAULT_PASS_FILE
4848unset RABBITMQ_ERLANG_COOKIE_FILE
4949
50+ # Write the cookie to disk so CLI tools (rabbitmqctl, rabbitmq-diagnostics)
51+ # invoked via "docker compose exec" can authenticate with the broker.
52+ # The env var is only visible to PID 1; exec'd shells read the file.
53+ # The file may already exist read-only (0400) from a previous run, so
54+ # widen permissions before overwriting, then lock back down.
55+ cookie_file=" ${RABBITMQ_MNESIA_DIR:-/ var/ lib/ rabbitmq} /.erlang.cookie"
56+ if [ -f " ${cookie_file} " ]; then
57+ chmod 600 " ${cookie_file} " 2> /dev/null || true
58+ fi
59+ printf ' %s' " ${cookie} " > " ${cookie_file} "
60+ chmod 400 " ${cookie_file} "
61+
5062entrypoint=" /opt/rabbitmq/sbin/docker-entrypoint.sh"
5163if [ ! -x " ${entrypoint} " ]; then
5264 entrypoint=" $( command -v docker-entrypoint.sh || true) "
You can’t perform that action at this time.
0 commit comments