0

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

munHunger
  • 2,572
  • 5
  • 34
  • 63
  • 2
    Are you performing a chmod +x on your script.sh on Jenkins? Before building the image? (or are you pulling the image). I would think you made it executable on your local host before building the image and everything works fine, but maybe it's not executable in your git (and jenkins is checking out the non-executable script and building it) – lvthillo Mar 26 '18 at 11:45
  • @lvthillo you were absolutely correct. The issue was with git and executable flags – munHunger Mar 26 '18 at 12:31

0 Answers0