#!/bin/bash # Credentials helper that returns values from environment variables: # * DOCKER_CREDS_USERNAME: the username # * DOCKER_CREDS_PASSWORD: the password / token # https://docs.docker.com/engine/reference/commandline/login/ case "$1" in get) read REGISTRY_HOST echo "Authenticating to ${REGISTRY_HOST} using environment variables" 1>&2 printf "{\"ServerURL\":\"${REGISTRY_HOST}\",\"Username\":\"${DOCKER_CREDS_USERNAME}\",\"Secret\":\"${DOCKER_CREDS_PASSWORD}\"}" ;; # erase) # # Called by docker logout, not needed here # # Handle erase # ;; # store) # # Called by docker login, not needed here # echo "Unsupported command ${1}" 1>&2 # exit 1 # ;; *) echo "Unsupported command ${1}" 1>&2 # Depends what we want to do here, fail or just noop # exit 1 ;; esac