Docker Community Forums

Share and learn in the Docker community.

Dockerfile entrypoint unable to switch user

docker

(Faizan Bashir) #1
#!/bin/bash
if [ -n "$USER_ID" -a -n "$GROUP_ID" ]; then
    chown -R $USER_NAME:$GROUP_NAME .
    su $USER_NAME
fi

php-fpm

exec "$@"

This is the entry point script which is supposed to change the user after changing the ownership of the directory. But the user is not getting changed, when I try to check the user running the container I always find root user running the container.

Please, help.