The following error happened in my environment which cannot connect to index.docker.io.

      $ docker run --rm --entrypoint /bin/true alpine:3.2
      Unable to find image 'alpine:3.2' locally
      Pulling repository docker.io/library/alpine
      docker: Error while pulling image: Get https://index.docker.io/v1/repositories/library/alpine/images: dial tcp 54.152.78.181:443: getsockopt: connection refused.
      See 'docker run --help'.
      FATAL: Failed to run docker image docker-registry.dev.cybozu.xyz/kintone/jenkins-build-base
      java.lang.RuntimeException: Failed to run docker image docker-registry.dev.cybozu.xyz/kintone/jenkins-build-base
      	at com.cloudbees.jenkins.plugins.docker_build_env.Docker.getDocker0Ip(Docker.java:249)
      	at com.cloudbees.jenkins.plugins.docker_build_env.Docker.runDetached(Docker.java:178)
      	at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.startBuildContainer(DockerBuildWrapper.java:202)
      	at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.setUp(DockerBuildWrapper.java:175)
      	at hudson.model.Build$BuildExecution.doRun(Build.java:156)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
      	at hudson.model.Run.execute(Run.java:1738)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:410)
      

      It seems that the following pull request is cause of this bug.

      https://github.com/jenkinsci/docker-custom-build-environment-plugin/pull/36

      The plugin was modified to use external image "alpine:3.2". However, this change is backward incompatible for environments in internal network with private docker registry.

      It is internal specification that the plugin uses the image, though building "alpine:3.2" image in a build environment can be a workaround. I think there should be a config option to specify the image for "/sbin/ip".

          [JENKINS-33232] Not working in internal network.

          Miyata Jumpei created issue -
          Miyata Jumpei made changes -
          Description Original: The following error happened in my environment which cannot connect to index.docker.io.

          $ docker run --rm --entrypoint /bin/true alpine:3.2
          Unable to find image 'alpine:3.2' locally
          Pulling repository docker.io/library/alpine
          docker: Error while pulling image: Get https://index.docker.io/v1/repositories/library/alpine/images: dial tcp 54.152.78.181:443: getsockopt: connection refused.
          See 'docker run --help'.
          FATAL: Failed to run docker image docker-registry.dev.cybozu.xyz/kintone/jenkins-build-base
          java.lang.RuntimeException: Failed to run docker image docker-registry.dev.cybozu.xyz/kintone/jenkins-build-base
          at com.cloudbees.jenkins.plugins.docker_build_env.Docker.getDocker0Ip(Docker.java:249)
          at com.cloudbees.jenkins.plugins.docker_build_env.Docker.runDetached(Docker.java:178)
          at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.startBuildContainer(DockerBuildWrapper.java:202)
          at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.setUp(DockerBuildWrapper.java:175)
          at hudson.model.Build$BuildExecution.doRun(Build.java:156)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
          at hudson.model.Run.execute(Run.java:1738)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:410)

          It seems that the following pull request is cause of this bug.

          https://github.com/jenkinsci/docker-custom-build-environment-plugin/pull/36

          The plugin was modified to use external image "alpine:3.2". However, this change is backward incompatible for environments in internal network with private docker registry.

          It is internal specification that the plugin uses the image, though building "alpine:3.2" image in a build environment can be a workaround. I think there should be a config option to specify the image for "/sbin/ip".
          New: The following error happened in my environment which cannot connect to index.docker.io.

          {noformat}
          $ docker run --rm --entrypoint /bin/true alpine:3.2
          Unable to find image 'alpine:3.2' locally
          Pulling repository docker.io/library/alpine
          docker: Error while pulling image: Get https://index.docker.io/v1/repositories/library/alpine/images: dial tcp 54.152.78.181:443: getsockopt: connection refused.
          See 'docker run --help'.
          FATAL: Failed to run docker image docker-registry.dev.cybozu.xyz/kintone/jenkins-build-base
          java.lang.RuntimeException: Failed to run docker image docker-registry.dev.cybozu.xyz/kintone/jenkins-build-base
          at com.cloudbees.jenkins.plugins.docker_build_env.Docker.getDocker0Ip(Docker.java:249)
          at com.cloudbees.jenkins.plugins.docker_build_env.Docker.runDetached(Docker.java:178)
          at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.startBuildContainer(DockerBuildWrapper.java:202)
          at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.setUp(DockerBuildWrapper.java:175)
          at hudson.model.Build$BuildExecution.doRun(Build.java:156)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
          at hudson.model.Run.execute(Run.java:1738)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:410)
          {noformat}

          It seems that the following pull request is cause of this bug.

          https://github.com/jenkinsci/docker-custom-build-environment-plugin/pull/36

          The plugin was modified to use external image "alpine:3.2". However, this change is backward incompatible for environments in internal network with private docker registry.

          It is internal specification that the plugin uses the image, though building "alpine:3.2" image in a build environment can be a workaround. I think there should be a config option to specify the image for "/sbin/ip".
          Alexander Kammerer made changes -
          Comment [ +1

          I have the same issue since the pull request was merged. ]

          Manuel Ryan added a comment -

          I'm having this issue too !

          I think a clean solution would be to add a configuration field to allow users to choose an image containing the "true" and "ip" binaries (with a default value of "alpine:3.2")

          That way we could push the alipne:3.2 image to our private registry and tell the plugin to use "my.private.registry/alpine:3.2" instead of "alpine:3.2"

          Manuel Ryan added a comment - I'm having this issue too ! I think a clean solution would be to add a configuration field to allow users to choose an image containing the "true" and "ip" binaries (with a default value of "alpine:3.2") That way we could push the alipne:3.2 image to our private registry and tell the plugin to use "my.private.registry/alpine:3.2" instead of "alpine:3.2"

          Code changed in jenkins
          User: Vincent Latombe
          Path:
          src/main/java/com/cloudbees/jenkins/plugins/docker_build_env/Docker.java
          src/main/java/com/cloudbees/jenkins/plugins/docker_build_env/DockerBuildWrapper.java
          src/main/resources/com/cloudbees/jenkins/plugins/docker_build_env/DockerBuildWrapper/global.jelly
          src/main/resources/com/cloudbees/jenkins/plugins/docker_build_env/DockerBuildWrapper/help-imageSbinIp.html
          http://jenkins-ci.org/commit/docker-custom-build-environment-plugin/0645b879410fe76bc743d30880f7364602d49a38
          Log:
          JENKINS-33232 Allow to define globally a docker image to use to
          execute /sbin/ip

          Compare: https://github.com/jenkinsci/docker-custom-build-environment-plugin/compare/9af2c39488e3^...0645b879410f

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Vincent Latombe Path: src/main/java/com/cloudbees/jenkins/plugins/docker_build_env/Docker.java src/main/java/com/cloudbees/jenkins/plugins/docker_build_env/DockerBuildWrapper.java src/main/resources/com/cloudbees/jenkins/plugins/docker_build_env/DockerBuildWrapper/global.jelly src/main/resources/com/cloudbees/jenkins/plugins/docker_build_env/DockerBuildWrapper/help-imageSbinIp.html http://jenkins-ci.org/commit/docker-custom-build-environment-plugin/0645b879410fe76bc743d30880f7364602d49a38 Log: JENKINS-33232 Allow to define globally a docker image to use to execute /sbin/ip Compare: https://github.com/jenkinsci/docker-custom-build-environment-plugin/compare/9af2c39488e3 ^...0645b879410f
          Vincent Latombe made changes -
          Assignee Original: Nicolas De Loof [ ndeloof ] New: Vincent Latombe [ vlatombe ]

          Letting user configure an image for this internal usage is far too technical for a good UX imho.
          I'd prefer the plugin to bundle a tiny go executable it can run as a single layer docker image to offer comparable gateway IP discovery.

          Nicolas De Loof added a comment - Letting user configure an image for this internal usage is far too technical for a good UX imho. I'd prefer the plugin to bundle a tiny go executable it can run as a single layer docker image to offer comparable gateway IP discovery.

          doesn't seem to be a trivial thing to re-implement ip routes in go (not available using go's `net` API, would require to do some syscalls ...
          simplest option then would probably to bundle an alpine image export (10Mb) as a tar.gz resource in plugin, so this one can load an run without dependency on dockerhub accessibility.

          Nicolas De Loof added a comment - doesn't seem to be a trivial thing to re-implement ip routes in go (not available using go's `net` API, would require to do some syscalls ... simplest option then would probably to bundle an alpine image export (10Mb) as a tar.gz resource in plugin, so this one can load an run without dependency on dockerhub accessibility.
          Nicolas De Loof made changes -
          Link New: This issue is blocking JENKINS-34967 [ JENKINS-34967 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 169118 ] New: JNJira + In-Review [ 183367 ]

            jonhermansen Jon Hermansen
            miyajan Miyata Jumpei
            Votes:
            10 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated: