简体   繁体   English

Docker 使用 AWS ECR 公共库运行

[英]Docker run using AWS ECR Public Gallery

I'm currently building a Lambda layer using我目前正在使用 Lambda 层构建

#!/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 .我受到 dockerhub 的限制,所以我想使用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但我得到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 ?如何docker run并从AWS ECR Public Gallery中提取?

check if you are already logged in to docker hub in file ~/.docker/config检查您是否已经在文件~/.docker/config中登录到docker hub

{
    "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. AWS ECR 公共图库任何人都可以提取图像。

Just a side note the image you are trying to pull will not have sam cli installed.请注意,您尝试提取的图像不会安装sam cli No official image yet published on gallery.ecr.aws with sam cli yet.尚未在gallery.ecr.aws上发布带有sam cli的官方图片。

You have to bake your own image with sam cli .您必须使用sam cli烘焙自己的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM