Created
June 29, 2019 21:16
-
-
Save nibalizer/36fb6a72cc3e48fe609392d37a12f339 to your computer and use it in GitHub Desktop.
script (from andreaf) to auth to ibm cloud registry using ko
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
ibmcloud login | |
ibmcloud cr login | |
REGISTRY_ENDPOINT=$(ibmcloud cr info | awk '/Registry/{ print $3 }' | head -1) | |
# Create a CR token with write access | |
CR_TOKEN=$(ibmcloud cr token-add --readwrite --description ko_rw --non-expiring -q) | |
# Backup your docker config if you have one | |
cp ~/.docker/config.json ~/.docker/config.json.$(date +%F) | |
# Setup docker auth so it may talk to the CR. | |
echo '{"auths":{"'$REGISTRY_ENDPOINT'":{"auth":"'$(echo -n token:$CR_TOKEN | base64 -w0)'"}}}' | jq '.' > ~/.docker/config.json | |
# Create a CR namespace | |
CR_NAMESPACE=knative | |
ibmcloud cr namespace-add $CR_NAMESPACE | |
# Configure ko | |
KO_DOCKER_REPO=$REGISTRY_ENDPOINT/$CR_NAMESPACE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment