Skip to content

Instantly share code, notes, and snippets.

@nolte
Last active September 21, 2017 17:34
Show Gist options
  • Save nolte/33a1a963d8161db0641b59f26d794e01 to your computer and use it in GitHub Desktop.
Save nolte/33a1a963d8161db0641b59f26d794e01 to your computer and use it in GitHub Desktop.
TravisCI deploy image to Dockerhub
#!/bin/bash
set -o errexit
DOCKER_USERNAME=$1
DOCKER_PASSWORD=$2
DOCKER_TAG_LOCAL=$3
DOCKER_CONTAINER_NAME=$4
VERSION=$5
# login dockerhub
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
# change the local tag name to the target name on dockerhub
docker tag $DOCKER_TAG_LOCAL $DOCKER_USERNAME/$DOCKER_CONTAINER_NAME:$VERSION
# push the container
docker push $DOCKER_USERNAME/$DOCKER_CONTAINER_NAME:$VERSION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment