Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
761 views
in Technique[技术] by (71.8m points)

amazon web services - Docker run using AWS ECR Public Gallery

I'm currently building a Lambda layer using

#!/usr/bin/env bash

build=("pip install -r requirements.txt -t python/ && "
        "lots &&",
        "more &&",
        "commands &&",
        "exit")
docker run -v "$PWD/":/var/task 
    "amazon/aws-sam-cli-build-image-python3.7" 
    /bin/sh -c "${build[*]}"

I'm getting throttled by dockerhub, so I'd like to use the AWS ECR Public Gallery.

I tried:

docker run -v "$PWD/":/var/task 
    "public.ecr.aws/lambda/python:3.7" 
    /bin/sh -c "${build[*]}"

But I get public.ecr.aws/lambda/python:3.7: No such file or directory

How can I do a docker run and have it pull from the AWS ECR Public Gallery?

question from:https://stackoverflow.com/questions/65943255/docker-run-using-aws-ecr-public-gallery

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

check if you are already logged in to docker hub in file ~/.docker/config

{
    "auths": {
            "https://index.docker.io/v1/": {}
    },
    ...

if yes then logout via

$docker logout
Removing login credentials for https://index.docker.io/v1/

AWS ECR Public Gallery anyone can pull images.

Just a side note the image you are trying to pull will not have sam cli installed. No official image yet published on gallery.ecr.aws with sam cli yet.

You have to bake your own image with sam cli.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...