'One of the configured repositories failed (Unknown),

Pretty new to docker; trying to get base layer setup on docker though it gives me these errors:

It's noting that the repository is failing / how do I set that repository? I don't think it's AWS issue as I have been able to see the AWS push in cloud formation.

$./generate_base_layer.sh
Error: No such container: layer-container
[+] Building 27.7s (6/13)                                                                            
 => [internal] load build definition from Dockerfile                                            0.0s
 => => transferring dockerfile: 551B                                                            0.0s
 => [internal] load .dockerignore                                                               0.0s
 => => transferring context: 2B                                                                 0.0s
 => [internal] load metadata for docker.io/library/amazonlinux:2                                0.9s
 => [auth] library/amazonlinux:pull token for registry-1.docker.io                              0.0s
 => [internal] load build context                                                               0.0s
 => => transferring context: 37B                                                                0.0s
 => [2/8] RUN yum install -y python37 &&     yum install -y python3-pip &&     yum install -y  26.7s
 => => # Loaded plugins: ovl, priorities           

 > [2/8] RUN yum install -y python37 &&     yum install -y python3-pip &&     yum install -y zip &&     yum clean all:                                                                                    
#6 0.369 Loaded plugins: ovl, priorities                                                             
#6 36.47                                                                                             
#6 36.47                                                                                             
#6 36.47  One of the configured repositories failed (Unknown),
#6 36.47  and yum doesn't have enough cached data to continue. At this point the only
#6 36.47  safe thing yum can do is fail. There are a few ways to work "fix" this:
#6 36.47 
#6 36.47      1. Contact the upstream for the repository and get them to fix the problem.
#6 36.47 
#6 36.47      2. Reconfigure the baseurl/etc. for the repository, to point to a working
#6 36.47         upstream. This is most often useful if you are using a newer
#6 36.47         distribution release than is supported by the repository (and the
#6 36.47         packages for the previous distribution release still work).
#6 36.47 
#6 36.47      3. Run the command with the repository temporarily disabled
#6 36.47             yum --disablerepo=<repoid> ...
#6 36.47 
#6 36.47      4. Disable the repository permanently, so yum won't use it by default. Yum
#6 36.47         will then just ignore the repository until you permanently enable it
#6 36.47         again or use --enablerepo for temporary usage:
#6 36.47 
#6 36.47             yum-config-manager --disable <repoid>
#6 36.47         or
#6 36.47             subscription-manager repos --disable=<repoid>
#6 36.47 
#6 36.47      5. Configure the failing repository to be skipped, if it is unavailable.
#6 36.47         Note that yum will try to contact the repo. when it runs most commands,
#6 36.47         so will have to try and fail each time (and thus. yum will be be much
#6 36.47         slower). If it is a very temporary problem though, this is often a nice
#6 36.47         compromise:
#6 36.47 
#6 36.47             yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
#6 36.47 
#6 36.47 Cannot find a valid baseurl for repo: amzn2-core/2/aarch64
#6 36.47 Could not retrieve mirrorlist http://amazonlinux.default.amazonaws.com/2/core/latest/aarch64/mirror.list error was
#6 36.47 12: Timeout on http://amazonlinux.default.amazonaws.com/2/core/latest/aarch64/mirror.list: (28, 'Failed to connect to amazonlinux.default.amazonaws.com port 80 after 4723 ms: Connection timed out')
------
executor failed running [/bin/sh -c yum install -y python37 &&     yum install -y python3-pip &&     yum install -y zip &&     yum clean all]: exit code: 1
Unable to find image 'base-layer:latest' locally
docker: Error response from daemon: pull access denied for base-layer, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
Error: No such container:path: layer-container:layer.zip

I've already logged into docker and tried it with docker build -t... ; same issue

dockerfile:

FROM amazonlinux:2

# Install Python
RUN yum install -y python37 && \
    yum install -y python3-pip && \
    yum install -y zip && \
    yum clean all

# Set up PIP and Venv
RUN python3.7 -m pip install --upgrade pip && \
    python3.7 -m pip install virtualenv
RUN python3.7 -m venv base
RUN source base/bin/activate

# Install dependencies
COPY ./requirements.txt .
RUN pip install -r requirements.txt -t ./python

# Zip it up for deployment.
RUN zip -r layer.zip ./python/
ENTRYPOINT ["/bin/bash", "-l"]

generate_base.. file:

# Generates a base layer for the Lambda functions.

# Remove the container first (if it exists).
docker rm layer-container

# Build the base layer.
docker build -t base-layer .

# Rename it to layer-container.
docker run --name layer-container base-layer

# Copy the generated zip artifact so our CDK can use it.
docker cp layer-container:layer.zip . && echo "Created layer.zip with updated base layer."


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source