Skip to content

Commit fc0466b

Browse files
committed
fix: case when uid/gid are 0 or missing
1 parent b6b4401 commit fc0466b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

scripts/entrypoint.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,18 @@ if [ "${1}" = "minio" ]; then
113113
# Stop temporary MinIO server.
114114
minio_stop_temp_server
115115

116-
if [ -n "${MY_UID}" ]; then
117-
usermod -u "${MY_UID}" minio
118-
chown -R "${MY_UID}" "${BUCKET_ROOT}"
116+
if [ -n "${MY_UID:-0}" ] && [ "${MY_UID:-0}" != "0" ]; then
117+
usermod -u "${MY_UID:-0}" minio
119118
fi
120-
if [ -n "${MY_GID}" ]; then
121-
groupmod -g "${MY_GID}" minio
122-
chgrp -R "${MY_GID}" "${BUCKET_ROOT}"
119+
if [ -n "${MY_GID:-0}" ] && [ "${MY_GID:-0}" != "0" ]; then
120+
groupmod -g "${MY_GID:-0}" minio
123121
fi
124122

123+
chown -R "${MY_UID:-0}" "${BUCKET_ROOT}"
124+
chgrp -R "${MY_GID:-0}" "${BUCKET_ROOT}"
125+
125126
# Run minio.
126-
gosu "${MY_UID:-root}:${MY_GID:-root}" /usr/bin/minio server "${BUCKET_ROOT}" --address ":${MINIO_PORT}" --console-address ":${MINIO_CONSOLE_PORT}" ${MINIO_OPTS}
127+
gosu "${MY_UID:-0}:${MY_GID:-0}" /usr/bin/minio server "${BUCKET_ROOT}" --address ":${MINIO_PORT}" --console-address ":${MINIO_CONSOLE_PORT}" ${MINIO_OPTS}
127128
fi
128129

129130
if [ "${1}" = "mc" ]; then

0 commit comments

Comments
 (0)