如何将构建的图像手动推送到 ECR?
How to push to a compose-built image to ECR manually?
我有一个 docker-compose 文件:
version: '3.4'
services:
nginx:
container_name: some-nginx
image: nginx:latest
restart: always
ports:
- 80:80
- 443:443
mongodb:
container_name: some-mongo
image: mongo:latest
environment:
- MONGO_DATA_DIR=/data/db
- MONGO_LOG_DIR=/dev/null
ports:
- 27017:27017
command: mongod --smallfiles --logpath=/dev/null # --quiet
我想使用以下命令推送到 Amazon Elastic Container Registry (ECR):
docker tag testapper:latest 619625705037.dkr.ecr.us-east-2.amazonaws.com/testapper:latest
但我收到一条消息:
Error response from daemon: No such image: testapper:latest
当我 运行 docker-compose build
收到这条消息时:
nginx uses an image, skipping
mongodb uses an image, skipping
这是什么意思?如何将我的图像推送到 ECR?
您的 docker 容器都在使用现有图像(image
关键字)
services:
nginx:
image: nginx:latest
mongodb:
image: mongo:latest
因此您不需要构建它们。
我相信ECS会自己找到这些官方镜像,所以你不需要将它们推送到你的私人仓库(ECR)。 (不是 100% 确定)
如果您确实想要推送自定义构建的图像,一般流程是
docker build -t your_image_name:tag path
docker tag your_image_name:tag 619625705037.dkr.ecr.us-east-2.amazonaws.com/your_image_name:tag
# or
docker build -t 619625705037.dkr.ecr.us-east-2.amazonaws.com/your_image_name:tag path
docker push 619625705037.dkr.ecr.us-east-2.amazonaws.com/your_image_name:tag
如果您的撰写文件类似于
,您可以使用docker-compose build
同时构建和标记
services:
nginx:
image: 619625705037.dkr.ecr.us-east-2.amazonaws.com/your_image_name:tag
build: ./my-nginx-path
我有一个 docker-compose 文件:
version: '3.4'
services:
nginx:
container_name: some-nginx
image: nginx:latest
restart: always
ports:
- 80:80
- 443:443
mongodb:
container_name: some-mongo
image: mongo:latest
environment:
- MONGO_DATA_DIR=/data/db
- MONGO_LOG_DIR=/dev/null
ports:
- 27017:27017
command: mongod --smallfiles --logpath=/dev/null # --quiet
我想使用以下命令推送到 Amazon Elastic Container Registry (ECR):
docker tag testapper:latest 619625705037.dkr.ecr.us-east-2.amazonaws.com/testapper:latest
但我收到一条消息:
Error response from daemon: No such image: testapper:latest
当我 运行 docker-compose build
收到这条消息时:
nginx uses an image, skipping
mongodb uses an image, skipping
这是什么意思?如何将我的图像推送到 ECR?
您的 docker 容器都在使用现有图像(image
关键字)
services:
nginx:
image: nginx:latest
mongodb:
image: mongo:latest
因此您不需要构建它们。
我相信ECS会自己找到这些官方镜像,所以你不需要将它们推送到你的私人仓库(ECR)。 (不是 100% 确定)
如果您确实想要推送自定义构建的图像,一般流程是
docker build -t your_image_name:tag path
docker tag your_image_name:tag 619625705037.dkr.ecr.us-east-2.amazonaws.com/your_image_name:tag
# or
docker build -t 619625705037.dkr.ecr.us-east-2.amazonaws.com/your_image_name:tag path
docker push 619625705037.dkr.ecr.us-east-2.amazonaws.com/your_image_name:tag
如果您的撰写文件类似于
,您可以使用docker-compose build
同时构建和标记
services:
nginx:
image: 619625705037.dkr.ecr.us-east-2.amazonaws.com/your_image_name:tag
build: ./my-nginx-path