0

Bug in docker.inside (withDockerContainer)?

I have 2 dockerfiles.   The first one I build with docker.build to get an image and then use image.run to get a container.  That works fine.

For the 2nd one, I also use docker.build to get an image.  But for the container, I am trying to use docker.inside() to build the container so I can do some other operations on that.  Here's where the oddness comes in.

The last line of my Dockerfile for the 2nd one has this line:

CMD ["catalina.sh", "run"]

When I create the container via docker itself or via docker.run, I get a container like this (note the command field):

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
b3ddb4ad9ac9        roar-web-image      "catalina.sh run"        17 seconds ago      Up 16 seconds       0.0.0.0:8089->8080/tcp   competent_noether

This is what I would expect.

When I use the docker.inside step, I instead end up with a container like this (again note the command field):

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
ae67a5984f15        roar-web-image      "cat"                    5 seconds ago       Up 4 seconds        0.0.0.0:8089->8080/tcp   boring_mclean

With the docker.inside, my web page is never available (which would be consistent with it trying to call "cat" instead of "catalina.sh run".

And, if I look in the console log, I can see this (note the "entrypoint cat" that somehow got there.


[Pipeline] withDockerContainer
$ docker run -t -d -u 1003:1003 --link 25a1b0d849b9d07075c01838b3d2640ecd8fadd294d8b1132a4a4dfefbeea73d:mysql -p 8089:8080 -w /home/jenkins2/worker_node2/workspace/script3 -v /home/jenkins2/worker_node2/workspace/script3:/home/jenkins2/worker_node2/workspace/script3:rw -v /home/jenkins2/worker_node2/workspace/script3@tmp:/home/jenkins2/worker_node2/workspace/script3@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat web-image

I tried specifying the --entrypoint as part of the arguments passed to the docker.inside call, but that had no effect.  This is odd besides being broken.  Since it shows up as "cat" instead of "catalina.sh run" in both the docker ps -a and the Jenkins log but is fine when done through docker.run, I think there's an issue somewhere.

 

 

 

0 comments

Please sign in to leave a comment.