I have created my own docker image for postgres because I needed some customization that wasn't out of the box available on the normal postgres images.
A part of my image is adding a setup script that is executed each time the container is started. And when I run in on my local machine it works exactly as expected. However when executed on our jenkins server I get this error:
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"/script/setup.sh\": permission denied".
Which I find really odd, especially since docker is supposed to remove the issues of "it works on my machine"
The script is pretty much just executing some postgres commands and moving files around and I don't think that it is the problem here. But this is how I add it:
USER root
RUN mkdir /script
ADD script /script
RUN chown -R postgres:postgres /script
USER postgres
So I am a bit confused as to wether or not this is an image/container problem or could it be because the jenkins server is lacking permissions to run the docker image? which btw would be odd, since it has permissions to build and delete images