amazonlinux / amazon-linux-2023

Amazon Linux 2023
https://aws.amazon.com/linux/amazon-linux-2023/
Other
501 stars 38 forks source link

[Bug] - Using as a base image for lambda custom runtime build fails locally #632

Closed wyattconsulting closed 3 months ago

wyattconsulting commented 4 months ago

Describe the bug

Docker file example:

FROM amazonlinux:2023 AS build
ENV LANG=en_US.UTF-8
RUN yum install -y gcc gcc-c++ glibc-devel curl-minimal bash zlib zlib-devel zlib-static zip tar gzip

fails with

Amazon Linux 2023 repository                    0.0  B/s |   0  B     04:54    
Errors during downloading metadata for repository 'amazonlinux':
  - Curl error (6): Couldn't resolve host name for https://cdn.amazonlinux.com/al2023/core/mirrors/2023.3.20240131/x86_64/mirror.list [Could not resolve host: cdn.amazonlinux.com]
Error: Failed to download metadata for repo 'amazonlinux': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for https://cdn.amazonlinux.com/al2023/core/mirrors/2023.3.20240131/x86_64/mirror.list [Could not resolve host: cdn.amazonlinux.com]
Ignoring repositories: amazonlinux

I suspect this is something to do with the dual stack endpoint and docker environments that don't support. This runs fine from Github Actions workers just not locally. This issue does not exist locally when using amazonlinux:2 as the build image.

The contents of the mirror.list file are currently: https://cdn.amazonlinux.com/al2023/core/guids/13b7adf43807001071ac72ab28ae148fec09921d55fb1fe4e173f3547a11d8e0/x86_64/ which it looks like is returning a 403 at the moment. Not sure if that is related.

elsaco commented 4 months ago

@wyattconsulting that could have been a temporary name resolution issue. Using your Dockerfile the build succeeded:

[elsaco@TEXAS aws]$ docker build .
[+] Building 15.9s (6/6) FINISHED                                                                        docker:default
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 193B                                                                               0.0s
 => [internal] load metadata for docker.io/library/amazonlinux:2023                                                1.4s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => [1/2] FROM docker.io/library/amazonlinux:2023@sha256:d8323b3ea56d286d65f9a7469359bb29519c636d7d009671ac00b5c1  4.1s
 => => resolve docker.io/library/amazonlinux:2023@sha256:d8323b3ea56d286d65f9a7469359bb29519c636d7d009671ac00b5c1  0.0s
 => => sha256:d8323b3ea56d286d65f9a7469359bb29519c636d7d009671ac00b5c12ddbacf0 547B / 547B                         0.0s
 => => sha256:62ebd855c09b363009221442fcb1d09aca167d4ba58f2cfd14e00e59ca2f2d54 529B / 529B                         0.0s
 => => sha256:d37f99a4f4de01d940c42f85bc05fb397c696b483f9baa0bd98ae8e82008e0e6 1.48kB / 1.48kB                     0.0s
 => => sha256:567d8ee5457ce911a8659b74a8187fbe402d4417070b8c4af0bf7d6289c1baae 52.25MB / 52.25MB                   1.1s
 => => extracting sha256:567d8ee5457ce911a8659b74a8187fbe402d4417070b8c4af0bf7d6289c1baae                          2.9s
 => [2/2] RUN yum install -y gcc gcc-c++ glibc-devel curl-minimal bash zlib zlib-devel zlib-static zip tar gzip    9.5s
 => exporting to image                                                                                             0.8s
 => => exporting layers                                                                                            0.7s
 => => writing image sha256:2eedbf8af1e5f85a0b10e0a05564232ceeb33fb7dd267a271b019b38e68ba396                       0.0s
wyattconsulting commented 4 months ago

I disabled IPv6 and it works locally now too. Could have been dns, but felt like something network because it was taking a few minutes to fail. I also confirmed at the time that it was not an issue from Github Actions workers.