I’m currently trying to get the build process for Docker Hardened Images to work inside a corporate network that requires a proxy to reach the internet.
My user as well as the docker daemon have been set up with http proxy environment vars / configs.
While the build is able to fetch the DHI Build image from dhi.io, in the next step it fails because it cannot reach the apk repositories:
$ docker buildx build . -f /home/me/tomcat-dhi.yaml --tag tomcat10jdk17:1.0 --load
[+] Building 2.2s (14/14) FINISHED
=> [internal] load build definition from tomcat-dhi.yaml
=> => transferring dockerfile: 5.52kB
=> resolve image config for docker-image://dhi.io/build:2-alpine3.24
=> [auth] build:pull token for dhi.io
=> CACHED docker-image://dhi.io/build:2-alpine3.24@sha256:3d90eac6694cec73030ea634338084e17e83533ca24f477c1f6851a0266be53b
=> => resolve dhi.io/build:2-alpine3.24@sha256:3d90eac6694cec73030ea634338084e17e83533ca24f477c1f6851a0266be53b
=> install repository key https://dhi.io/keyring/dhi-apk@docker-0F81AD7700D99184.rsa.pub
=> CACHED copy artifacts
=> CACHED mkfile /packages
=> CACHED initialize repo
=> CACHED mkdir /etc/apk
=> CACHED add repositories
=> CACHED mkdir /etc/apk/keys
=> CACHED add keys
=> CACHED copy /dhi-apk@docker-0F81AD7700D99184.rsa.pub /etc/apk/keys/dhi-apk@docker-0F81AD7700D99184.rsa.pub
=> ERROR fetch package locations
------
> fetch package locations:
0.276 packages: alpine-baselayout-data apr busybox eclipse-temurin-17-jdk-oci-config eclipse-temurin-17-jdk libgcc libstdc++ musl openssl tzdata
0.276 target architecture: amd64
0.325 WARNING: updating and opening https://dhi.io/apk/alpine/v3.24/main/x86_64/APKINDEX.tar.gz: TLS: unspecified error
0.343 WARNING: updating and opening https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/APKINDEX.tar.gz: TLS: unspecified error
0.355 WARNING: updating and opening https://dl-cdn.alpinelinux.org/alpine/v3.24/community/x86_64/APKINDEX.tar.gz: TLS: unspecified error
0.355 3 unavailable, 0 stale; 0 distinct packages available
------
tomcat-dhi.yaml:38
--------------------
37 | packages:
38 | >>> - alpine-baselayout-data
39 | >>> - apr
40 | >>> - busybox
41 | >>> - eclipse-temurin-17-jdk-oci-config=17.0.20.8-r1
42 | >>> - eclipse-temurin-17-jdk=17.0.20.8-r1
43 | >>> - libgcc
44 | >>> - libstdc++
45 | >>> - musl
46 | >>> - openssl
47 | >>> - tzdata
48 | builds:
--------------------
ERROR: failed to build: failed to solve: process "sh -c /packages alpine-baselayout-data apr busybox eclipse-temurin-17-jdk-oci-config eclipse-temurin-17-jdk libgcc libstdc++ musl openssl tzdata" did not complete successfully: exit code: 3
Now, we do have our own artifactory running within our network and I attempted to pull the packages from there, but this then leads to certificate problems:
0.330 WARNING: updating and opening https://myartifactory.internal/artifactory/dhi-alpine-remote/v3.24/main/x86_64/APKINDEX.tar.gz: TLS: server certificate not trusted
0.367 WARNING: updating and opening https://myartifactory.internal/artifactory/alpine-remote/v3.24/main/x86_64/APKINDEX.tar.gz: TLS: server certificate not trusted
0.403 WARNING: updating and opening https://myartifactory.internal/artifactory/alpine-remote/v3.24/community/x86_64/APKINDEX.tar.gz: TLS: server certificate not trusted
This is the point where I’m starting to be out of ideas and the documentation doesn’t talk about this use case as far as I can see. I need either the ability to configure a proxy and/or CA certificates for the DHI build container OR - and I’m not happy about the thought - I need to pry open the DHI build image and add these things myself.
Open to ideas and suggestions
Hex