[JIRA] (JENKINS-41316) docker.image('my-image').inside{...} no longer honors Dockerfile "entrypoint" since version 1.8

7 views
Skip to first unread message

cleclerc@cloudbees.com (JIRA)

unread,
Jan 23, 2017, 5:35:01 AM1/23/17
to jenkinsc...@googlegroups.com
Cyrille Le Clerc updated an issue
 
Jenkins / Bug JENKINS-41316
docker.image('my-image').inside{...} no longer honors Dockerfile "entrypoint" since version 1.8
Change By: Cyrille Le Clerc
Summary: docker.image('my-image').inside{...} no longer honors Dockerfile "entrypoint" no longer honored by docker-pipeline: since version 1.8
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

cleclerc@cloudbees.com (JIRA)

unread,
Jan 23, 2017, 5:36:01 AM1/23/17
to jenkinsc...@googlegroups.com
Cyrille Le Clerc updated an issue
The docker pipeline plugin used to honor the Dockerfile "entrypoint" until v1.8 in {{docker . image('my-image').inside\{...\}}}. Since then, "entrypoint" is ignored and the capability to do selenium tests fails.


This regression seems to be caused by JENKINS-37987 and the github commit [\[FIXED JENKINS-37987\] Override ENTRYPOINT, not just command, for WithContainerStep|https://github.com/jenkinsci/docker-workflow-plugin/commit/5b0586d6bd87fc4f108693ee9361252a24eb37d1]

This Jira seem to be similar to JENKINS-39748

h3. Testcase

h4. Code

{code}
node ("docker") {
    docker.image('cloudbees/java-build-tools:2.0.0').inside {

        // verify that selenium-standalone-server has been started by the Dockerfile entrypoint /opt/bin/entry_point.sh
        sh "curl http://127.0.0.1:4444/wd/hub"
        
        // test with selenium python
        writeFile (
            file: 'selenium_remote_web_driver_test.python',
            text:
"""#!/usr/bin/env python

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

driver = webdriver.Remote(
   command_executor='http://127.0.0.1:4444/wd/hub',
   desired_capabilities=DesiredCapabilities.FIREFOX)

driver.get('http://python.org')
assert 'Python' in driver.title
""")

        sh "python selenium_remote_web_driver_test.python"

    }
}
{code}

h4. Console

The check "{{curl http://127.0.0.1:4444/wd/hub}}" will fail.

{noformat}
Started by user admin
[Pipeline] node
Running on agent-1 in /home/ubuntu/jenkins-aws-home/workspace/tests/testSelenium2
[Pipeline] {
[Pipeline] sh
[testSelenium2] Running shell script
+ docker inspect -f . cloudbees/java-build-tools:2.0.0
.
[Pipeline] withDockerContainer
$ docker run -t -d -u 1000:1000 -w /home/ubuntu/jenkins-aws-home/workspace/tests/testSelenium2 -v /home/ubuntu/jenkins-aws-home/workspace/tests/testSelenium2:/home/ubuntu/jenkins-aws-home/workspace/tests/testSelenium2:rw -v /home/ubuntu/jenkins-aws-home/workspace/tests/testSelenium2@tmp:/home/ubuntu/jenkins-aws-home/workspace/tests/testSelenium2@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat cloudbees/java-build-tools:2.0.0
[Pipeline] {
[Pipeline] sh
[testSelenium2] Running shell script
+ curl http://127.0.0.1:4444/wd/hub
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                     Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to 127.0.0.1 port 4444: Connection refused
[Pipeline] }
$ docker stop --time=1 c65380bfd6c83d2290fc2e8fa8e5ae4cb0b84d1b21c66b4a3019c4a831f8833c
$ docker rm -f c65380bfd6c83d2290fc2e8fa8e5ae4cb0b84d1b21c66b4a3019c4a831f8833c
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 7
Finished: FAILURE
{noformat}

h3. Workaround

The workaround is to manually start the Dockerfile entrypoint with {{sh "nohup /opt/bin/entry_point.sh &"}}.

h4. Code

{code}
node ("docker") {
    docker.image('cloudbees/java-build-tools:2.0.0').inside {
        // WORKAROUND: MANUALLY START THE DOCKERFILE ENTRYPOINT
        sh "nohup /opt/bin/entry_point.sh &"
        sh "sleep 5"
        
        // verify that selenium-standalone-server has been started by the Dockerfile entrypoint /opt/bin/entry_point.sh
        sh "curl http://127.0.0.1:4444/wd/hub"
        
        // test with selenium python
        writeFile (
            file: 'selenium_remote_web_driver_test.python',
            text:
"""#!/usr/bin/env python

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

driver = webdriver.Remote(
   command_executor='http://127.0.0.1:4444/wd/hub',
   desired_capabilities=DesiredCapabilities.FIREFOX)

driver.get('http://python.org')
assert 'Python' in driver.title
""")

        sh "python selenium_remote_web_driver_test.python"

    }
}
{code}

h4. Console

{noformat}
Started by user admin
[Pipeline] node
Running on agent-1 in /home/ubuntu/jenkins-aws-home/workspace/tests/testSelenium2
[Pipeline] {
[Pipeline] sh
[testSelenium2] Running shell script
+ docker inspect -f . cloudbees/java-build-tools:2.0.0
.
[Pipeline] withDockerContainer
$ docker run -t -d -u 1000:1000 -w /home/ubuntu/jenkins-aws-home/workspace/tests/testSelenium2 -v /home/ubuntu/jenkins-aws-home/workspace/tests/testSelenium2:/home/ubuntu/jenkins-aws-home/workspace/tests/testSelenium2:rw -v /home/ubuntu/jenkins-aws-home/workspace/tests/testSelenium2@tmp:/home/ubuntu/jenkins-aws-home/workspace/tests/testSelenium2@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat cloudbees/java-build-tools:2.0.0
[Pipeline] {
[Pipeline] sh
[testSelenium2] Running shell script
+ nohup /opt/bin/entry_point.sh
[Pipeline] sh
[testSelenium2] Running shell script
+ sleep 5
[Pipeline] sh
[testSelenium2] Running shell script
+ curl http://127.0.0.1:4444/wd/hub
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                     Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
[Pipeline] writeFile
[Pipeline] sh
[testSelenium2] Running shell script
+ python selenium_remote_web_driver_test.python
[Pipeline] }
$ docker stop --time=1 804a1f9cac0e8040b5e882a7c3ebd052df53e9cb99b34c0a7ffba4d0abff5401
$ docker rm -f 804a1f9cac0e8040b5e882a7c3ebd052df53e9cb99b34c0a7ffba4d0abff5401
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
{noformat}

cleclerc@cloudbees.com (JIRA)

unread,
Jan 23, 2017, 5:37:01 AM1/23/17
to jenkinsc...@googlegroups.com
Cyrille Le Clerc updated an issue
The docker pipeline plugin used to honor the Dockerfile "entrypoint" until v1.8 in " {{docker.image('my-image').inside\{...\}}} " . Since then, "entrypoint" is ignored and the .

The
capability to do selenium tests with a selenium-standalone-server running inside the Docker container fails since 1 . 8.

cleclerc@cloudbees.com (JIRA)

unread,
Jan 23, 2017, 5:37:01 AM1/23/17
to jenkinsc...@googlegroups.com
Cyrille Le Clerc updated an issue
The docker pipeline plugin used to honor the Dockerfile "entrypoint" until v1.8 in "{{docker.image('my-image').inside\{...\}}}". Since then, "entrypoint" is ignored.


The capability to do selenium tests with a selenium-standalone-server running inside the Docker container fails since 1.8.


This regression seems to be caused by JENKINS-37987 and the github commit " [\[FIXED JENKINS-37987\] Override ENTRYPOINT, not just command, for WithContainerStep|https://github.com/jenkinsci/docker-workflow-plugin/commit/5b0586d6bd87fc4f108693ee9361252a24eb37d1] ".

ryan.campbell@gmail.com (JIRA)

unread,
Jan 25, 2017, 6:08:01 AM1/25/17
to jenkinsc...@googlegroups.com
recampbell commented on Bug JENKINS-41316
 
Re: docker.image('my-image').inside{...} no longer honors Dockerfile "entrypoint" since version 1.8

It's not clear to me why your usecase is driving you to need docker.inside{}. When I use the selenium image, the withRun approach works great.

cleclerc@cloudbees.com (JIRA)

unread,
Jan 25, 2017, 10:00:04 AM1/25/17
to jenkinsc...@googlegroups.com

recampbell I took the flow of "Jenkins, The Definitive guide" and tried to make it work with as few differences as possible between:

  • A 'classic' linux build agent with Firefox that works with Java Selenium test frameworks
  • A vanilla linux build agent using docker-pipeline to customize the build environment and get the desired JDK, Maven & Firefox with Firefox working with Java Selenium test frameworks
  • A Docker based cloud agent (Kubernetes Agents, Amazon ECS Agents... ) so that the entire build runs in a Docker container that brings all the customization (JDK, Maven & Firefox)

Here is what I have succeeded to implement until docker-pipeline 1.8. The only trick was to switch the Selenium driver from Firefox to Remote+Firefox to use XVFB.

The pipeline below is almost the same on classic linux, docker-pipeline and docker based cloud agents. Since docker-pipeline:1.8, I need to add something like "nohup /opt/bin/entry_point.sh &".

node ('docker'){

    docker.image('cloudbees/java-build-tools:2.0.0').inside {
        git 'https://github.com/cyrille-leclerc/game-of-life.git'
        stage 'Build Web App'
        withMaven(mavenSettingsConfig: 'maven-settings-for-gameoflife') {

            sh "mvn clean package"
            step([$class: 'ArtifactArchiver', artifacts: 'gameoflife-web/target/*.war'])
        }
    }

    docker.image('cloudbees/java-build-tools:2.0.0').inside {
      withMaven(
              mavenSettingsConfig: 'maven-settings-for-gameoflife',
              mavenLocalRepo: '.repository') {
           
            sh """
               cd gameoflife-acceptance-tests
               mvn verify -Dwebdriver.driver=remote -Dwebdriver.remote.driver=firefox -Dwebdriver.remote.url=http://localhost:4444/wd/hub -Dwebdriver.base.url=http://...
            """
        }
    }
}

andrew.bayer@gmail.com (JIRA)

unread,
Jan 26, 2017, 1:00:01 PM1/26/17
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Jan 26, 2017, 1:00:01 PM1/26/17
to jenkinsc...@googlegroups.com
Andrew Bayer started work on Bug JENKINS-41316
 
Change By: Andrew Bayer
Status: Open In Progress

andrew.bayer@gmail.com (JIRA)

unread,
Jan 26, 2017, 1:01:01 PM1/26/17
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Jan 26, 2017, 1:02:01 PM1/26/17
to jenkinsc...@googlegroups.com
Andrew Bayer commented on Bug JENKINS-41316
 
Re: docker.image('my-image').inside{...} no longer honors Dockerfile "entrypoint" since version 1.8

I've put a PR up at https://github.com/jenkinsci/docker-workflow-plugin/pull/85 - it reverts .inside behavior to pre-JENKINS-37987 behavior, while adding a new .overrideEntrypoint method that works identically to how .inside worked post-JENKINS-37987.

cleclerc@cloudbees.com (JIRA)

unread,
Jan 27, 2017, 5:43:01 AM1/27/17
to jenkinsc...@googlegroups.com

jglick@cloudbees.com (JIRA)

unread,
Jan 30, 2017, 2:50:02 PM1/30/17
to jenkinsc...@googlegroups.com

mkobit@gmail.com (JIRA)

unread,
Mar 30, 2017, 9:28:01 PM3/30/17
to jenkinsc...@googlegroups.com
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

leonardo.la@gmail.com (JIRA)

unread,
Feb 12, 2018, 3:35:03 PM2/12/18
to jenkinsc...@googlegroups.com
Leo Luz commented on Bug JENKINS-41316

We are using 1.15 in our company and we are having the same issue. My docker image has an entrypoint defined and image.inside() invokes docker as:
docker run -t -d -u 1000:1000 -w /var/jenkins/workspace/....myimage:mytag cat
The problem is that cat is not a recognized flag for my entrypoint and it fails in the next command:
$ docker top 52da7791facd2487ad299b815207b539f7c0f54ec0c53c66337b25f81a6c2bb4
with the error:
java.io.IOException: Failed to run top '52da7791facd2487ad299b815207b539f7c0f54ec0c53c66337b25f81a6c2bb4'. Error: Error response from daemon: Container 52da7791facd2487ad299b815207b539f7c0f54ec0c53c66337b25f81a6c2bb4 is not running
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.listProcess(DockerClient.java:140)
at org.jenkinsci.plugins.docker.workflow.WithContainerStep$Execution.start(WithContainerStep.java:185)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:229)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:153)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:19)
As a workaround Im doing in my Jenkinsfile:
script {↩
image.inside('--entrypoint ""') {↩
// do something
}↩
}↩
This fixes my issue because I don't need the entrypoint definition at this stage but it would be nice to have the plugin working as expected.

 

Thank you!

leonardo.la@gmail.com (JIRA)

unread,
Feb 12, 2018, 3:37:03 PM2/12/18
to jenkinsc...@googlegroups.com
Leo Luz edited a comment on Bug JENKINS-41316
We are using 1.15 in our company and we are having the same issue. My docker image has an entrypoint defined and {{image.inside()}} invokes docker as:
{noformat}
docker run -t -d -u 1000:1000 -w /var/jenkins/workspace/....myimage:mytag cat {noformat}
The problem is that {{cat}} is not a recognized flag for my entrypoint and it fails in the next command:
{noformat}
$ docker top 52da7791facd2487ad299b815207b539f7c0f54ec0c53c66337b25f81a6c2bb4 {noformat}
with the error:
{noformat}
java.io.IOException: Failed to run top '52da7791facd2487ad299b815207b539f7c0f54ec0c53c66337b25f81a6c2bb4'. Error: Error response from daemon: Container 52da7791facd2487ad299b815207b539f7c0f54ec0c53c66337b25f81a6c2bb4 is not running
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.listProcess(DockerClient.java:140)
at org.jenkinsci.plugins.docker.workflow.WithContainerStep$Execution.start(WithContainerStep.java:185)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:229)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:153)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:19) {noformat}
As a workaround Im doing in my Jenkinsfile:
{noformat}
script \ {↩
    image.inside('--entrypoint ""')
\ {↩
        // do something
    }↩
}↩
{noformat}
This fixes my issue because I don't need the {{entrypoint}} definition at this stage but it would be nice to have the plugin working as expected.

 

Thank you!

hans@starefossen.com (JIRA)

unread,
Feb 12, 2018, 5:18:02 PM2/12/18
to jenkinsc...@googlegroups.com

The 1.15 release really screwed up all of our builds involving containers. Reverted to 1.14.

nik.reiman@ableton.com (JIRA)

unread,
Feb 13, 2018, 10:07:03 AM2/13/18
to jenkinsc...@googlegroups.com

Ditto here, 1.15 has caused a bunch of our container-related builds to fail. Looking at the diff of https://github.com/jenkinsci/docker-workflow-plugin/pull/116/files, it seems that the "detection" is looking for `cat` commands, which we are not using within `docker.image.inside`.

Sadly the `–entrypoint ""` workaround also does not work in our case and we have reverted to 1.14 for now. Is there another JIRA issue already to track this regression, or should this one be re-opened?

nicolas.deloof@gmail.com (JIRA)

unread,
Feb 13, 2018, 10:11:06 AM2/13/18
to jenkinsc...@googlegroups.com

nicolas.deloof@gmail.com (JIRA)

unread,
Feb 13, 2018, 10:11:08 AM2/13/18
to jenkinsc...@googlegroups.com
Nicolas De Loof commented on Bug JENKINS-41316
 
Re: docker.image('my-image').inside{...} no longer honors Dockerfile "entrypoint" since version 1.8

Please don't re-open this issue, regression has been caught already and addressed in JENKINS-49278

nicolas.deloof@gmail.com (JIRA)

unread,
Feb 19, 2018, 3:34:03 AM2/19/18
to jenkinsc...@googlegroups.com

sachin.gupta771@gmail.com (JIRA)

unread,
Feb 21, 2019, 5:11:05 AM2/21/19
to jenkinsc...@googlegroups.com
sachin gupta reopened an issue
 

I'm still facing the same issue with Jenkins version 2.161,

I have search many issues opened and closed without any proper resolution to this problem, please provide the suitable resolution

Change By: sachin gupta
Resolution: Fixed
Status: Closed Reopened
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

nicolas.deloof@gmail.com (JIRA)

unread,
Apr 24, 2019, 10:30:40 AM4/24/19
to jenkinsc...@googlegroups.com

faucher.benp@gmail.com (JIRA)

unread,
Apr 2, 2020, 9:28:14 AM4/2/20
to jenkinsc...@googlegroups.com
Ben Faucher commented on Bug JENKINS-41316
 
Re: docker.image('my-image').inside{...} no longer honors Dockerfile "entrypoint" since version 1.8

I just ran into this issue. Is this going to be addressed? Why is the entrypoint overridden in the first place?

This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages