Created
August 30, 2017 05:47
-
-
Save metral/2c65a0732b51b69a616a6726b4e1a7cc to your computer and use it in GitHub Desktop.
k8s registry creds
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
#!/bin/bash | |
AUTH="$DOCKER_USERNAME:$DOCKER_PASSWORD" | |
AUTH_B64=$(echo -n $AUTH | base64 -w 0) | |
DOCKERCFG="{ | |
\"auths\": { | |
\"$DOCKER_REGISTRY\": { | |
\"auth\": \"$AUTH_B64\" | |
} | |
} | |
} | |
" | |
DOCKERCFG_B64=`echo -n $DOCKERCFG | base64 -w 0` | |
cat > registry-creds.yaml << EOF | |
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: registry-creds | |
data: | |
.dockerconfigjson: ${DOCKERCFG_B64} | |
type: kubernetes.io/dockerconfigjson | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment