File Permission error in Google Cloud (GKE) Kubernetes Docker Container

7/28/2017

I am trying to run a initialisation script within my Docker container which is deployed using the Kubernetes kubectl command on the Google Cloud Container Engine (GKE).

The script executes without error in the docker container on my local system, but does not seem to work on GKE.

I am using the root account to execute the script on GKE.

The Dockerfile environment variable is set to: ENV SUEXECUSERGROUP false

The path to shell script is mapped to an external persistent disk. I have done this so that I do not need to hardcode any paths within the shell script:

/path-to-shell-script/ is mapped to ~/parent-folder

The docker entry point is:

/usr/local/bin/docker-entrypoint.sh

The shell script is located at:

shell script /path-to-shell-script/fix.sh

When the container is loading (initialisation) I receive the following error:

./fix.sh: Permission denied

When I run ls -lad /path-to-shell-script/ from within the container, I get the following output:

drwxr-sr-x 19 apache apache 4096 /path-to-shell-script/

ls -la /path-to-shell-script/ also shows:

... -rwxrwxr-x 1 root root 988 fix.sh ...

-- Arman Nisch
bash
docker
file-permissions
google-cloud-platform
kubernetes

0 Answers