#!/bin/sh
set -e

# Using $3 since CMD is expended by shell as
# entrypoint /bin/sh -c CMD
if [ "$3" = 'pipelines' -a "$(id -u)" = '0' ]; then
    chown -R pipelines .
    exec gosu pipelines "$0" "$@"
fi

exec "$@"
#!/bin/sh
set -e

if [ "$1" = 'pipelines' -a "$(id -u)" = '0' ]; then
    chown -R pipelines .
    exec gosu pipelines "$0" "$@"
fi

exec "$@"
--- 
+++ 
@@ -1,9 +1,7 @@
 #!/bin/sh
 set -e
 
-# Using $3 since CMD is expended by shell as
-# entrypoint /bin/sh -c CMD
-if [ "$3" = 'pipelines' -a "$(id -u)" = '0' ]; then
+if [ "$1" = 'pipelines' -a "$(id -u)" = '0' ]; then
     chown -R pipelines .
     exec gosu pipelines "$0" "$@"
 fi
Update entrypoint to look for 3rd param...
