Skip to content

Commit

Permalink
Allow su-exec to fail when users explicity use --user
Browse files Browse the repository at this point in the history
This allows MinIO containers to run properly without
expecting higher privileges in situations where following
restrictions on containers are used

 - docker run --user uid:gid
 - docker-compose up (with docker-compose.yml with user)
 ```yml
 ...
 user: "1001:1001"
 command: minio server /data
 ...
 ```
 - All openshift containers

Fixes minio#7773
  • Loading branch information
harshavardhana committed Jun 12, 2019
1 parent 0394a8f commit 72e6000
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dockerscripts/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ docker_switch_user() {
return
fi
fi
exec su-exec "${owner}" "$@"
# check if su-exec is allowed, if yes proceed proceed.
if su-exec "${owner}" "/bin/ls" >/dev/null 2>&1; then
exec su-exec "${owner}" "$@"
fi
# fallback
exec "$@"
}

## Set access env from secrets if necessary.
Expand Down

0 comments on commit 72e6000

Please sign in to comment.