Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 231cbb6

Browse files
fix: export_images.sh (#2424)
1 parent 46bc56f commit 231cbb6

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

‎dev/export_images.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/bin/bash
2+
13
# Copyright 2022 Cortex Labs, Inc.
24
#
35
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,13 +32,23 @@ source_registry=quay.io/cortexlabs # this can also be docker.io/cortexlabs
3032

3133
destination_ecr_prefix="cortexlabs"
3234
destination_registry="${aws_account_id}.dkr.ecr.${ecr_region}.amazonaws.com/${destination_ecr_prefix}"
33-
aws ecr get-login-password --region $ecr_region | docker login --username AWS --password-stdin $destination_registry
35+
36+
if [[ -f $HOME/.docker/config.json && $(cat $HOME/.docker/config.json | grep "ecr-login" | wc -l) -ne 0 ]]; then
37+
echo "skipping docker login because you are using ecr-login with Amazon ECR Docker Credential Helper"
38+
else
39+
aws ecr get-login-password --region $ecr_region | docker login --username AWS --password-stdin $destination_registry
40+
fi
3441

3542
source $ROOT/build/images.sh
3643

3744
# create the image repositories
3845
for image in "${all_images[@]}"; do
39-
aws ecr create-repository --repository-name=$destination_ecr_prefix/$image --region=$ecr_region || true
46+
repository_name=$destination_ecr_prefix/$image
47+
if aws ecr describe-repositories --repository-names=$repository_name --region=$ecr_region >/dev/null 2>&1; then
48+
echo "repository '$repository_name' already exists"
49+
else
50+
aws ecr create-repository --repository-name=$repository_name --region=$ecr_region | cat
51+
fi
4052
done
4153
echo
4254

‎docs/clusters/advanced/self-hosted-images.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ git clone --depth 1 --branch v$CORTEX_VERSION https://github.com/cortexlabs/cort
2727

2828
Run the script below to export images to ECR in the same region and account as your cluster.
2929

30+
The script will automatically create ECR Repositories with prefix `cortexlabs` if they don't already exist.
31+
3032
Feel free to modify the script if you would like to export the images to a different registry such as a private docker hub.
3133

3234
```bash

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /