Certificate error when using docker buildx

Viewed 782

I am having a very weird issue when building an armv7 docker image using docker buildx, but not when building it natively on armv7 hardware.

Here is a very simple docker image:

FROM ubuntu:20.04

ARG ARCH

RUN apt-get update && \
    apt-get install -y curl wget

# Install Go
ENV GOLANG_VERSION 1.15.8
RUN set -eux; \
    \
    url="https://golang.org/dl/go${GOLANG_VERSION}.linux-${ARCH}.tar.gz"; \
    wget -O go.tgz "$url"; \
    tar -C /usr/local -xzf go.tgz; \
    rm go.tgz; \
    export PATH="/usr/local/go/bin:$PATH"; \
    go version

I can build the image for arm64 both on macos as well on a raspberrypi just fine. No such luck when building it for armv7 tho.

I am building the image on macos using buildx as follows:

docker buildx build --platform linux/arm/v7 -t test:armv7 --build-arg ARCH=armv6l .

This fails with a certificate error when connecting to golang.org:

#7 0.378 Resolving golang.org (golang.org)... 142.250.185.113, 2a00:1450:4001:80f::2011
#7 0.448 Connecting to golang.org (golang.org)|142.250.185.113|:443... connected.
#7 0.682 ERROR: cannot verify golang.org's certificate, issued by 'CN=GTS CA 1O1,O=Google Trust Services,C=US':
#7 0.682   Unable to locally verify the issuer's authority.
#7 0.688 To connect to golang.org insecurely, use `--no-check-certificate'.

However if I build the exact same image natively on armv7 (raspberry pi 2b) it works just fine:

docker build -t test:armv7 --build-arg ARCH=armv6l .

Needless to say I am very confused why one works and the other one doesn't.

1 Answers

add to wget command to do not check a ssl certificate -k argument

for you

FROM ubuntu:20.04

ARG ARCH

RUN apt-get update && \
    apt-get install -y curl wget

# Install Go
ENV GOLANG_VERSION 1.15.8
RUN set -eux; \
    \
    url="https://golang.org/dl/go${GOLANG_VERSION}.linux-${ARCH}.tar.gz"; \
    wget -k -O go.tgz "$url"; \
    tar -C /usr/local -xzf go.tgz; \
    rm go.tgz; \
    export PATH="/usr/local/go/bin:$PATH"; \
    go version

best way it will be install the ca-cerificates pacage. do this in apt-get install -y curl wget ca-certificates

Related