In debian 9 image, the su command does not send the exported functions to the context of the command running in su, so the suexec command does not work. (if $BRICKS_LINUX == "true").
To simulate in debian 8 (jessie):
$ docker run -it debian:jessie bash
# paste the code below
info() {
message=$1;
echo -e "\n\033[32m${message}\033[0m\n";
}
export -f info
useradd -u 1000 -m -d /home/builder builder
su builder -m -c "bash -ec 'type info'"
# info is a function
# info ()
#{
# message=$1;
# echo -e "\n\033[32m${message}\033[0m\n"
#}
To simulate in debian 9 (strech):
$ docker run -it debian:strech bash
# paste the code below
info() {
message=$1;
echo -e "\n\033[32m${message}\033[0m\n";
}
export -f info
useradd -u 1000 -m -d /home/builder builder
su builder -m -c "bash -ec 'type info'"
# bash: line 0: type: info: not found
As an alternative, it is possible to use $BRICKS_LINUX == "false", so all the commands will run with the root user.
In debian 9 image, the
sucommand does not send the exported functions to the context of the command running insu, so the suexec command does not work. (if $BRICKS_LINUX == "true").To simulate in debian 8 (jessie):
To simulate in debian 9 (strech):
As an alternative, it is possible to use $BRICKS_LINUX == "false", so all the commands will run with the root user.