-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new script that fixes windows ecr login issues (#222)
- Loading branch information
1 parent
aec1d18
commit 963860f
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
usage=$(cat << EOM | ||
Download and install amazon-ecr-credential-helper for Docker client. | ||
usage: $(basename $0) [-h] VERSION | ||
Options: | ||
-h Print help message then exit | ||
Arguments: | ||
VERSION Version number of amazon-ecr-login-helper to download and install (e.g. 0.7.1) | ||
EOM | ||
) | ||
|
||
function display_help { | ||
echo "${usage}" 1<&2 | ||
} | ||
|
||
while getopts "h" arg; do | ||
case "${arg}" in | ||
h ) display_help | ||
exit 0 | ||
;; | ||
|
||
* ) display_help | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
shift $((OPTIND-1)) | ||
|
||
version="${1:-}" | ||
if [[ -z "${version}" ]]; then | ||
echo "❌ no version given" | ||
display_help | ||
exit 1 | ||
fi | ||
|
||
install_path="$(dirname "$(which docker-credential-wincred.exe)")" | ||
curl -Lo "${install_path}/docker-credential-ecr-login.exe" "https://amazon-ecr-credential-helper-releases.s3.us-east-2.amazonaws.com/${version}/windows-amd64/docker-credential-ecr-login.exe" | ||
|
||
# Update Docker to use ecr-login instead of wincred. | ||
modified_config="$(mktemp)" | ||
jq '.credsStore="ecr-login"' ~/.docker/config.json > "${modified_config}" | ||
mv -f "${modified_config}" ~/.docker/config.json |