0

I'm using buildpacks and paketo to build my images from a spring-boot gradle project.

I'm behind a corporate proxy (using cntlm and already exported: http_proxy=http://localhost:3128 and https_proxy=http://localhost:3128)

I've also added a configuration file for docker ~/.docker/config.json:

{
  "proxies": {
    "default": {
      "httpProxy":  "http://localhost:3128",
      "httpsProxy": "http://localhost:3128"
    }
  }
}

But I'm stuck with this error :

===> ANALYZING
Previous image with name "my-gateway" not found
===> DETECTING
10 of 26 buildpacks participating
paketo-buildpacks/ca-certificates   3.6.0
paketo-buildpacks/bellsoft-liberica 9.11.0
paketo-buildpacks/syft              1.26.0
paketo-buildpacks/gradle            6.11.0
paketo-buildpacks/executable-jar    6.6.2
paketo-buildpacks/apache-tomcat     7.12.1
paketo-buildpacks/apache-tomee      1.6.1
paketo-buildpacks/liberty           3.5.0
paketo-buildpacks/dist-zip          5.5.2
paketo-buildpacks/spring-boot       5.23.0
===> RESTORING
===> BUILDING

Paketo Buildpack for CA Certificates 3.6.0
  https://github.com/paketo-buildpacks/ca-certificates
  Launch Helper: Contributing to layer
    Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper

Paketo Buildpack for BellSoft Liberica 9.11.0
  https://github.com/paketo-buildpacks/bellsoft-liberica
  Build Configuration:
    $BP_JVM_JLINK_ARGS           --no-man-pages --no-header-files --strip-debug --compress=1  configure custom link arguments (--output must be omitted)
    $BP_JVM_JLINK_ENABLED        false                                                        enables running jlink tool to generate custom JRE
    $BP_JVM_TYPE                 JRE                                                          the JVM type - JDK or JRE
    $BP_JVM_VERSION              11                                                           the Java version
  Launch Configuration:
    $BPL_DEBUG_ENABLED           false                                                        enables Java remote debugging support
    $BPL_DEBUG_PORT              8000                                                         configure the remote debugging port
    $BPL_DEBUG_SUSPEND           false                                                        configure whether to suspend execution until a debugger has attached
    $BPL_HEAP_DUMP_PATH                                                                       write heap dumps on error to this path
    $BPL_JAVA_NMT_ENABLED        true                                                         enables Java Native Memory Tracking (NMT)
    $BPL_JAVA_NMT_LEVEL          summary                                                      configure level of NMT, summary or detail
    $BPL_JFR_ARGS                                                                             configure custom Java Flight Recording (JFR) arguments
    $BPL_JFR_ENABLED             false                                                        enables Java Flight Recording (JFR)
    $BPL_JMX_ENABLED             false                                                        enables Java Management Extensions (JMX)
    $BPL_JMX_PORT                5000                                                         configure the JMX port
    $BPL_JVM_HEAD_ROOM           0                                                            the headroom in memory calculation
    $BPL_JVM_LOADED_CLASS_COUNT  35% of classes                                               the number of loaded classes in memory calculation
    $BPL_JVM_THREAD_COUNT        250                                                          the number of threads in memory calculation
    $JAVA_TOOL_OPTIONS                                                                        the JVM launch flags
    Using buildpack default Java version 11
  BellSoft Liberica JDK 11.0.18: Contributing to layer
    Downloading from https://github.com/bell-sw/Liberica/releases/download/11.0.18+10/bellsoft-jdk11.0.18+10-linux-amd64.tar.gz
unable to invoke layer creator
unable to get dependency jdk
unable to download https://github.com/bell-sw/Liberica/releases/download/11.0.18+10/bellsoft-jdk11.0.18+10-linux-amd64.tar.gz
unable to request https://github.com/bell-sw/Liberica/releases/download/11.0.18+10/bellsoft-jdk11.0.18+10-linux-amd64.tar.gz
Get "https://github.com/bell-sw/Liberica/releases/download/11.0.18+10/bellsoft-jdk11.0.18+10-linux-amd64.tar.gz": proxyconnect tcp: dial tcp 127.0.0.1:3128: connect: connection refused
ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle: failed with status code: 51

Beside :

I can download this files with wget command

Any idea to fix this ?

I'm on Ubuntu 20.04.5 LTS

flywell
  • 384
  • 3
  • 20

1 Answers1

0

You need to configure this in your build.gradle file.

tasks.named("bootBuildImage") {
    environment["HTTP_PROXY"] = "http://proxy.example.com"
    environment["HTTPS_PROXY"] = "https://proxy.example.com"
}

https://docs.spring.io/spring-boot/docs/3.0.5/gradle-plugin/reference/htmlsingle/#build-image.examples.builder-configuration

This will allow the buildpack that runs inside of the container, created from the builder image, to access the internet through the defined proxies.

Daniel Mikusa
  • 13,716
  • 1
  • 22
  • 28
  • As you can see I'm not using `bootBuildImage` – flywell Mar 24 '23 at 07:56
  • It's actually not clear, you mentioned "spring-boot gradle project", so that's the direction I went. – Daniel Mikusa Mar 24 '23 at 16:44
  • Pack has this documented here -> https://buildpacks.io/docs/app-developer-guide/using-http-proxy/. It will pick up and pass through http_proxy and https_proxy from your local env to the buildpacks, so if that's not working double check how you're exporting those variables. – Daniel Mikusa Mar 24 '23 at 16:46