File tree 2 files changed +9
-5
lines changed
2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ ENV PATH /usr/lib/rabbitmq/bin:$PATH
42
42
43
43
RUN echo '[{rabbit, [{loopback_users, []}]}].' > /etc/rabbitmq/rabbitmq.config
44
44
45
+ # set home so that any `--user` knows where to put the erlang cookie
46
+ ENV HOME /var/lib/rabbitmq
47
+
45
48
VOLUME /var/lib/rabbitmq
46
49
47
50
# add a symlink to the .erlang.cookie in /root so we can "docker exec rabbitmqctl ..." without gosu
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
set -e
3
3
4
+ # allow the container to be started with `--user`
5
+ if [ " $1 " = ' rabbitmq-server' -a " $( id -u) " = ' 0' ]; then
6
+ chown -R rabbitmq /var/lib/rabbitmq
7
+ exec gosu rabbitmq " $BASH_SOURCE " " $@ "
8
+ fi
9
+
4
10
ssl=
5
11
if [ " $RABBITMQ_SSL_CERT_FILE " -a " $RABBITMQ_SSL_KEY_FILE " -a " $RABBITMQ_SSL_CA_FILE " ]; then
6
12
ssl=1
@@ -22,7 +28,6 @@ if [ "$RABBITMQ_ERLANG_COOKIE" ]; then
22
28
else
23
29
echo " $RABBITMQ_ERLANG_COOKIE " > " $cookieFile "
24
30
chmod 600 " $cookieFile "
25
- chown rabbitmq " $cookieFile "
26
31
fi
27
32
fi
28
33
@@ -126,7 +131,6 @@ if [ "$1" = 'rabbitmq-server' ]; then
126
131
# Create combined cert
127
132
cat " $RABBITMQ_SSL_CERT_FILE " " $RABBITMQ_SSL_KEY_FILE " > /tmp/combined.pem
128
133
chmod 0400 /tmp/combined.pem
129
- chown rabbitmq /tmp/combined.pem
130
134
131
135
# More ENV vars for make clustering happiness
132
136
# we don't handle clustering in this script, but these args should ensure
@@ -135,9 +139,6 @@ if [ "$1" = 'rabbitmq-server' ]; then
135
139
export RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS=" -pa '$ERL_SSL_PATH ' -proto_dist inet_tls -ssl_dist_opt server_certfile /tmp/combined.pem -ssl_dist_opt server_secure_renegotiate true client_secure_renegotiate true"
136
140
export RABBITMQ_CTL_ERL_ARGS=" $RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS "
137
141
fi
138
-
139
- chown -R rabbitmq /var/lib/rabbitmq
140
- set -- gosu rabbitmq " $@ "
141
142
fi
142
143
143
144
exec " $@ "
You can’t perform that action at this time.
0 commit comments