Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-39485

withContainerStep fails if using entrypoint in DockerFile

XMLWordPrintable

      I noticed today while trying something like the below code that cat just gets passed to the entrypoint that the image was built with. I think that it is the container = dockerClient.run(env, step.image, step.args, ws, volumes, volumesFromContainers, envReduced, dockerClient.whoAmI(), /* expected to hang until killed */ "cat"); line. Would it be better to override the entrypoint=/bin/cat instead of passing cat as the argument?

      My current workaround is to build a custom image and set the CMD line in the docker file instead of having the entrypoint set.

      def terraform(String tfArgs) {
        def dockerArgs = "-v ${workingDirectory}/:${tempDirectory}/ \
            -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY "
        def dockerBuildImage = docker.image("hashicorp/terraform:${TF_VERSION}").inside(dockerArgs) {
          sh "echo Starting Terraform with args: ${tfArgs}"
          sh "/bin/terraform ${tfArgs}"
        }
        // sh "docker run --rm -v ${workingDirectory}/:${tempDirectory}/ -w=${tempDirectory}/ -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY hashicorp/terraform:${TF_VERSION} ${tfArgs}"
      }
      
      

            Unassigned Unassigned
            pryorda Daniel Pryor
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: