Docker Community Forums

Share and learn in the Docker community.

Advices & help needed : Github + Jenkins + Docker, permission denied

Hi there,
I’m a young student trying to do something a little bit complicated to me :slight_smile:

I’ve got a repo on github with my Dockerfile in (with many config file too, as an Entrypoint.sh who initialize some things when i run docker Container with my docker image)

I would like to connect my github repo with Jenkins (something i think i successed) and i want to use Docker directly into Jenkins.

In fact We have :

My Github Repo with my Dockerfile manage by Jenkins2 (& pipelines) => Jenkins Build my Docker Image with my Dockerfile on Github

( docker build -t solene/installtv2 . )

At this step, I just want to use Jenkins to run Docker containers to test applications dev by my coworkers.

But each time I try to run Docker container this error appear :

docker run -e DATABASE_TYPE=mysql -e DATABASE_USER=tracimuser -e DATABASE_PASSWORD=tracimpassword -e DATABASE_HOST=192.168.1.73 -e DATABASE_NAME=tracimdb solene/installtv2

container_linux.go:262: starting container process caused "exec: \"/tracim/entrypoint.sh\": permission denied"

docker: Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused "exec: \"/tracim/entrypoint.sh\": permission denied".

time="2017-08-17T11:21:12+02:00" level=error msg="error waiting for container: context canceled" 

script returned exit code 126

I don’t understand why :confused: When I try it localy it works :confused:
Do you have some advices ?
Is it better to user master/slave configuration in this case ? (thing i don’t know how to use, and i don’t really understand)

Thank’s for your help ! :slight_smile:

can you post a docker run --entrypoint bash YOUR_IMAGE ls -lisa /ENTRYPOINT-PATH…from there you can step by step try to reduce the problem to its root cause.

Thank’s for your answer ! I will try your solution to reduce the problem :slight_smile:

So,
I’ve just tried to use this command :

docker run --entrypoint bash solene/installtv2 ls -lisa /var/lib/jenkins/workspace/Sowlene_Testdocker_master-PYO76PG2MVGEIIOJ3RJCE7EOHZTFGO7XLVV32IOJYUTNYG42QINA/entrypoint.sh -e DATABASE_TYPE=sqlite -e DATABASE_USER=tracimuser -e DATABASE_PASSWORD=tracimpassword -e DATABASE_HOST=192.168.1.73 -e DATABASE_NAME=tracimdb

And it return :

/usr/bin/ls: /usr/bin/ls: cannot execute binary file script returned exit code 126

EDIT :

I’ve tried : docker run --entrypoint bash solene/installtv2 -c ls -lisa /var/lib/jenkins/workspace/Sowlene_Testdocker_master-PYO76PG2MVGEIIOJ3RJCE7EOHZTFGO7XLVV32IOJYUTNYG42QINA/entrypoint.sh -e DATABASE_TYPE=sqlite -e DATABASE_USER=tracimuser -e DATABASE_PASSWORD=tracimpassword -e DATABASE_HOST=192.168.1.73 -e DATABASE_NAME=tracimdb
And this step works ! It returns :
bin
boot
dev
etc
home
lib
lib32
lib64
libx32
media
mnt
opt
proc
root
run
sbin
srv
sys
tmp
tracim
usr
var

But other steps doesn’t work :confused:

yes…so go on with the -c version.

Can you explain what this command is trying to do ? (Sorry for my english :confused: )

Or the difference between :
docker run -e DATABASE_TYPE=mysql -e DATABASE_USER=tracimuser -e DATABASE_PASSWORD=tracimpassword -e DATABASE_HOST=192.168.1.73 -e DATABASE_NAME=tracimdb solene/installtv2

and
docker run --entrypoint bash solene/installtv2 -c ls -lisa /var/lib/jenkins/workspace/Sowlene_Testdocker_master-PYO76PG2MVGEIIOJ3RJCE7EOHZTFGO7XLVV32IOJYUTNYG42QINA/entrypoint.sh -e DATABASE_TYPE=sqlite -e DATABASE_USER=tracimuser -e DATABASE_PASSWORD=tracimpassword -e DATABASE_HOST=192.168.1.73 -e DATABASE_NAME=tracimdb

?

Why the last command return :
bin boot dev etc home lib lib32 lib64 libx32 media mnt ... What does it means ?

bash is a shell. It executes every command you provide it.

ls -lisaprints you all files in the current directory with access rights, sizes, …

try to stick to bash as entrypoint instead of your script until you know what causes the problem with your entrypoint.

You also could try to start just a bash and then debug your entrypoint-script. Not sure if you know set -x. This could be helpful to see where exactly your entrypoint fails.

But locally my entrypoint doesn’t fail :confused:

I know “-x” but i can’t use it into Jenkins, or i don’t know how i can !?

So, when i used this command
docker run --entrypoint bash solene/installtv2 -c ls -lisa /var/lib/jenkins/workspace/Sowlene_Testdocker_master-PYO76PG2MVGEIIOJ3RJCE7EOHZTFGO7XLVV32IOJYUTNYG42QINA/entrypoint.sh -e DATABASE_TYPE=sqlite -e DATABASE_USER=tracimuser -e DATABASE_PASSWORD=tracimpassword -e DATABASE_HOST=192.168.1.73 -e DATABASE_NAME=tracimdb

What docker do ? Is it running my container or is it just stopping the execution at ls -lisa /var/lib … without running my container ?