dockerBuild does not pull base image behind corporate proxy
See original GitHub issueDescription of the issue:
A dockerBuild
fails on Windows 10 behind a corporate proxy. The docker registry can not be reached.
Expected behavior:
The maven build should pull the base image and use the proxy settings in settings.xml
Steps to reproduce:
- define proxy in
~/.m2/settings.xml
- Create a minimal maven project
** pom.xml (no deps, no build etc.)
** one java class with main method in
src/main/java
** build image withmvn clean compile -Dimage=dockertest:0.0.1 com.google.cloud.tools:jib-maven-plugin:1.0.0-rc1:dockerBuild
Environment:
Windows 10
java -version
openjdk version "1.8.0_192"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_192-b12)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.192-b12, mixed mode)
docker info
Containers: 7
Running: 1
Paused: 0
Stopped: 6
Images: 10
Server Version: 18.09.0
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.125-linuxkit
Operating System: Docker for Windows
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.934GiB
Name: linuxkit-00155d032b0b
ID: LERF:MQOZ:ZG6J:LWNI:NJ7Z:QY6A:RS6U:ZMF5:45O5:526Y:BN6L:ZAOU
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 28
Goroutines: 52
System Time: 2019-01-10T08:45:11.253532Z
EventsListeners: 1
HTTP Proxy: 172.20.249.23:8080
HTTPS Proxy: 172.20.249.23:8080
No Proxy: localhost;127.0.0.1
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T21:39:06+02:00)
Maven home: C:\Entwicklung\Java\apache-maven-3.5.0\bin\..
Java version: 1.8.0_192, vendor: Oracle Corporation
Java home: C:\Entwicklung\Java\jdk8u192-b12\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Log output:
[INFO] --- jib-maven-plugin:1.0.0-rc1:dockerBuild (default-cli) @ dockertest ---
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=0, ConflictMarker.nodeCount=105, ConflictIdSorter.graphTime=1, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=49, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=2, ConflictResolver.conflictItemCount=102, DefaultDependencyCollector.collectTime=254, DefaultDependencyCollector.transformTime=3}
[DEBUG] com.google.cloud.tools:jib-maven-plugin:jar:1.0.0-rc1:
[DEBUG] com.google.http-client:google-http-client:jar:1.23.0:compile
[DEBUG] com.google.code.findbugs:jsr305:jar:1.3.9:compile
[DEBUG] org.apache.httpcomponents:httpclient:jar:4.0.1:compile
[DEBUG] org.apache.httpcomponents:httpcore:jar:4.0.1:compile
[DEBUG] commons-logging:commons-logging:jar:1.1.1:compile
[DEBUG] commons-codec:commons-codec:jar:1.3:compile
[DEBUG] org.apache.commons:commons-compress:jar:1.18:compile
[DEBUG] com.google.guava:guava:jar:23.5-jre:compile
[DEBUG] org.checkerframework:checker-qual:jar:2.0.0:compile
[DEBUG] com.google.errorprone:error_prone_annotations:jar:2.0.18:compile
[DEBUG] com.google.j2objc:j2objc-annotations:jar:1.1:compile
[DEBUG] org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
[DEBUG] com.fasterxml.jackson.core:jackson-databind:jar:2.9.6:compile
[DEBUG] com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[DEBUG] com.fasterxml.jackson.core:jackson-core:jar:2.9.6:compile
[DEBUG] org.javassist:javassist:jar:3.22.0-GA:compile
[DEBUG] org.apache.maven:maven-plugin-api:jar:3.5.2:compile
[DEBUG] org.apache.maven:maven-model:jar:3.5.2:compile
[DEBUG] org.apache.maven:maven-artifact:jar:3.5.2:compile
[DEBUG] org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.3.3:compile
[DEBUG] javax.enterprise:cdi-api:jar:1.0:compile
[DEBUG] javax.annotation:jsr250-api:jar:1.0:compile
[DEBUG] org.codehaus.plexus:plexus-utils:jar:3.1.0:compile
[DEBUG] org.codehaus.plexus:plexus-classworlds:jar:2.5.2:compile
[DEBUG] org.apache.maven:maven-core:jar:3.5.2:compile
[DEBUG] org.apache.maven:maven-settings:jar:3.5.2:compile
[DEBUG] org.apache.maven:maven-settings-builder:jar:3.5.2:compile
[DEBUG] org.codehaus.plexus:plexus-interpolation:jar:1.24:compile
[DEBUG] org.sonatype.plexus:plexus-sec-dispatcher:jar:1.4:compile
[DEBUG] org.sonatype.plexus:plexus-cipher:jar:1.4:compile
[DEBUG] org.apache.maven:maven-builder-support:jar:3.5.2:compile
[DEBUG] org.apache.maven:maven-repository-metadata:jar:3.5.2:compile
[DEBUG] org.apache.maven:maven-model-builder:jar:3.5.2:compile
[DEBUG] org.apache.maven:maven-resolver-provider:jar:3.5.2:compile
[DEBUG] org.apache.maven.resolver:maven-resolver-impl:jar:1.1.0:compile
[DEBUG] org.apache.maven.resolver:maven-resolver-api:jar:1.1.0:compile
[DEBUG] org.apache.maven.resolver:maven-resolver-spi:jar:1.1.0:compile
[DEBUG] org.apache.maven.resolver:maven-resolver-util:jar:1.1.0:compile
[DEBUG] org.apache.maven.shared:maven-shared-utils:jar:3.1.0:compile
[DEBUG] commons-io:commons-io:jar:2.5:compile
[DEBUG] org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.3.3:compile
[DEBUG] com.google.inject:guice:jar:no_aop:4.0:compile
[DEBUG] aopalliance:aopalliance:jar:1.0:compile
[DEBUG] javax.inject:javax.inject:jar:1:compile
[DEBUG] org.codehaus.plexus:plexus-component-annotations:jar:1.7.1:compile
[DEBUG] org.apache.commons:commons-lang3:jar:3.5:compile
[DEBUG] org.apache.maven.shared:maven-verifier:jar:1.6:compile
[DEBUG] junit:junit:jar:3.8.2:compile
[DEBUG] Created new class realm plugin>com.google.cloud.tools:jib-maven-plugin:1.0.0-rc1
[DEBUG] Importing foreign packages into class realm plugin>com.google.cloud.tools:jib-maven-plugin:1.0.0-rc1
[DEBUG] Imported: < maven.api
[DEBUG] Populating class realm plugin>com.google.cloud.tools:jib-maven-plugin:1.0.0-rc1
[DEBUG] Included: com.google.cloud.tools:jib-maven-plugin:jar:1.0.0-rc1
[DEBUG] Included: com.google.http-client:google-http-client:jar:1.23.0
[DEBUG] Included: com.google.code.findbugs:jsr305:jar:1.3.9
[DEBUG] Included: org.apache.httpcomponents:httpclient:jar:4.0.1
[DEBUG] Included: org.apache.httpcomponents:httpcore:jar:4.0.1
[DEBUG] Included: commons-logging:commons-logging:jar:1.1.1
[DEBUG] Included: commons-codec:commons-codec:jar:1.3
[DEBUG] Included: org.apache.commons:commons-compress:jar:1.18
[DEBUG] Included: com.google.guava:guava:jar:23.5-jre
[DEBUG] Included: org.checkerframework:checker-qual:jar:2.0.0
[DEBUG] Included: com.google.errorprone:error_prone_annotations:jar:2.0.18
[DEBUG] Included: com.google.j2objc:j2objc-annotations:jar:1.1
[DEBUG] Included: org.codehaus.mojo:animal-sniffer-annotations:jar:1.14
[DEBUG] Included: com.fasterxml.jackson.core:jackson-databind:jar:2.9.6
[DEBUG] Included: com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0
[DEBUG] Included: com.fasterxml.jackson.core:jackson-core:jar:2.9.6
[DEBUG] Included: org.javassist:javassist:jar:3.22.0-GA
[DEBUG] Included: javax.enterprise:cdi-api:jar:1.0
[DEBUG] Included: javax.annotation:jsr250-api:jar:1.0
[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:3.1.0
[DEBUG] Included: org.codehaus.plexus:plexus-interpolation:jar:1.24
[DEBUG] Included: org.sonatype.plexus:plexus-sec-dispatcher:jar:1.4
[DEBUG] Included: org.sonatype.plexus:plexus-cipher:jar:1.4
[DEBUG] Included: org.apache.maven:maven-builder-support:jar:3.5.2
[DEBUG] Included: org.apache.maven.resolver:maven-resolver-util:jar:1.1.0
[DEBUG] Included: org.apache.maven.shared:maven-shared-utils:jar:3.1.0
[DEBUG] Included: commons-io:commons-io:jar:2.5
[DEBUG] Included: org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.3.3
[DEBUG] Included: com.google.inject:guice:jar:no_aop:4.0
[DEBUG] Included: aopalliance:aopalliance:jar:1.0
[DEBUG] Included: org.codehaus.plexus:plexus-component-annotations:jar:1.7.1
[DEBUG] Included: org.apache.commons:commons-lang3:jar:3.5
[DEBUG] Included: org.apache.maven.shared:maven-verifier:jar:1.6
[DEBUG] Included: junit:junit:jar:3.8.2
[DEBUG] Configuring mojo com.google.cloud.tools:jib-maven-plugin:1.0.0-rc1:dockerBuild from plugin realm ClassRealm[plugin>com.google.cloud.tools:jib-maven-plugin:1.0.0-rc1, parent: sun.misc.Launcher$AppClassLoader@7852e922]
[DEBUG] Configuring mojo 'com.google.cloud.tools:jib-maven-plugin:1.0.0-rc1:dockerBuild' with basic configurator -->
[DEBUG] (f) allowInsecureRegistries = false
[DEBUG] (f) project = MavenProject: de.jakop:dockertest:0.0.1-SNAPSHOT @ C:\Entwicklung\git-repositories\de.jakop.micro\dockertest\pom.xml
[DEBUG] (f) session = org.apache.maven.execution.MavenSession@7bf9b098
[DEBUG] (f) skip = false
[DEBUG] -- end configuration --
[DEBUG] Searching for main class... Add a 'mainClass' configuration to 'jib-maven-plugin' to improve build speed.
[DEBUG] Could not find a valid main class specified in 'maven-jar-plugin'; attempting to infer main class.
[INFO]
[INFO] Containerizing application to Docker daemon as dockertest:0.0.1...
[DEBUG] Containerizing application with the following files:
[DEBUG] Classes:
[DEBUG] C:\Entwicklung\git-repositories\de.jakop.micro\dockertest\target\classes\TestApp.class
[WARNING] Base image 'gcr.io/distroless/java' does not use a specific image digest - build may not be reproducible
[DEBUG] TIMING Building image to Docker daemon
[INFO] Executing tasks:
[INFO] [ ] 0,0% complete
[INFO] > building image to Docker daemon
[INFO]
[INFO] Executing tasks:
[INFO] [ ] 0,0% complete
[INFO] > pulling base image manifest
[INFO]
[DEBUG] TIMING Pulling base image manifest
[INFO] Executing tasks:
[INFO] [ ] 0,0% complete
[INFO] > pulling base image manifest
[INFO]
[INFO] Executing tasks:
[INFO] [ ] 0,0% complete
[INFO] > pulling base image manifest
[INFO] > setting up to build application layers
[INFO]
[DEBUG] TIMING Building application layers
[INFO] Executing tasks:
[INFO] [ ] 0,0% complete
[INFO] > pulling base image manifest
[INFO] > setting up to build application layers
[INFO]
[DEBUG] TIMED Building application layers : 0.0 ms
[INFO] Executing tasks:
[INFO] [ ] 0,0% complete
[INFO] > pulling base image manifest
[INFO] > setting up to build application layers
[INFO]
[INFO] Executing tasks:
[INFO] [======= ] 13,3% complete
[INFO] > pulling base image manifest
[INFO] > building classes layer
[INFO]
[DEBUG] TIMING Building classes layer
[INFO] Executing tasks:
[INFO] [======= ] 13,3% complete
[INFO] > pulling base image manifest
[INFO] > building classes layer
[INFO]
[DEBUG] Building classes layer built sha256:8503f27d6cfd2e18c6a2eb056fb59e672647c1c41944e47449ed8f79f568052d
[INFO] Executing tasks:
[INFO] [======= ] 13,3% complete
[INFO] > pulling base image manifest
[INFO] > building classes layer
[INFO]
[DEBUG] TIMED Building classes layer : 436.0 ms
[INFO] Executing tasks:
[INFO] [======= ] 13,3% complete
[INFO] > pulling base image manifest
[INFO] > building classes layer
[INFO]
[INFO] Executing tasks:
[INFO] [======== ] 16,7% complete
[INFO] > pulling base image manifest
[INFO]
[DEBUG] TIMED Pulling base image manifest : 20585.0 ms
[INFO] Executing tasks:
[INFO] [======== ] 16,7% complete
[INFO] > pulling base image manifest
[INFO]
[INFO] Executing tasks:
[INFO] [================= ] 33,3% complete
[INFO] > building image to Docker daemon
[INFO]
[INFO] Executing tasks:
[INFO] [========================= ] 50,0% complete
[INFO] > building image to Docker daemon
[INFO]
[DEBUG] TIMED Building image to Docker daemon : 20596.0 ms
[INFO] Executing tasks:
[INFO] [========================= ] 50,0% complete
[INFO] > building image to Docker daemon
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.571 s
[INFO] Finished at: 2019-01-10T09:39:16+01:00
[INFO] Final Memory: 19M/212M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.0.0-rc1:dockerBuild (default-cli) on project dockertest: Build to Docker daemon failed: Connect to gcr.io/74.125.140.82:443 timed out -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.0.0-rc1:dockerBuild (default-cli) on project dockertest: Build to Docker daemon failed
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Build to Docker daemon failed
at com.google.cloud.tools.jib.maven.BuildDockerMojo.execute(BuildDockerMojo.java:148)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to gcr.io/74.125.140.82:443 timed out
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:335)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:123)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:147)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:108)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554)
at com.google.api.client.http.apache.ApacheHttpRequest.execute(ApacheHttpRequest.java:65)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:981)
at com.google.cloud.tools.jib.http.Connection.send(Connection.java:207)
at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call(RegistryEndpointCaller.java:232)
at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.callWithAllowInsecureRegistryHandling(RegistryEndpointCaller.java:152)
at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call(RegistryEndpointCaller.java:142)
at com.google.cloud.tools.jib.registry.RegistryClient.callRegistryEndpoint(RegistryClient.java:356)
at com.google.cloud.tools.jib.registry.RegistryClient.pullManifest(RegistryClient.java:202)
at com.google.cloud.tools.jib.registry.RegistryClient.pullManifest(RegistryClient.java:210)
at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.pullBaseImage(PullBaseImageStep.java:213)
at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.call(PullBaseImageStep.java:126)
at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.call(PullBaseImageStep.java:59)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:127)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:80)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Additional Information:
- docker operations from command line working as expected through proxy (
docker pull
,docker push
) - maven operations working as expected through proxy (get artifacts from central)
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Cannot download Docker images behind a proxy
After that, test the proxy settings by running a command in a new container from an image which is not downloaded: $ docker...
Read more >Configure Docker to use a proxy server - Docker Documentation
On the Docker client, create or edit the file ~/.docker/config.json in the home directory of the user that starts containers. Add JSON similar...
Read more >Using Docker Behind a Proxy | Cloudbees Blog
In today's article, I am going to explore a common pain point for anyone running Docker in a large corporate environment.
Read more >Docker and Proxy - Medium
Working behind a corporate proxy can be a painful experience. Attempts to simply accessing web resources are spoiled.
Read more >Docker run works behind proxy, and Docker build does not
My company uses a proxy with NTLM authentication, ... But my build of base image is failing saying docker daemon is not running....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://docs.oracle.com/javase/8/docs/api/java/net/doc-files/net-properties.html
@SlimenTN like
mvn -Dhttp.proxyHost=my.company.proxy.com -Dhttp.proxyPort=... -Dhttps.proxyHost=... compile ...
.I will have to double check, but probably we are getting the default value (
http
) for<protocol>
from the Maven API.However, in this issue (and in most usual cases I think) the
https
needs to be defined too.UPDATED: confirmed. Jib gets
http
when not specified. However, users should have a proxy entry forhttps
too in almost all cases.