Skip to content

Instantly share code, notes, and snippets.

@IsaacHatilima
Created December 8, 2022 14:14
Show Gist options
  • Save IsaacHatilima/8a47bd6bea30aae497dee306032c5fed to your computer and use it in GitHub Desktop.
Save IsaacHatilima/8a47bd6bea30aae497dee306032c5fed to your computer and use it in GitHub Desktop.
- step:
name:
Push To Docker Hub
services:
- docker
script:
- docker logout
#Authenticate on Docker
#The below says Error: Cannot perform an interactive login from a non TTY device
- docker login --username $DOCKER_HUB_USERNAME --password-stdin $DOCKER_HUB_PASSWORD
#The below says invalid username or password
# - echo $DOCKER_HUB_PASSWORD | docker login --username $DOCKER_HUB_USERNAME --password-stdin
#Build Docker Image
- docker build -t myticket.azurecr.io/myticket .
#Push to Docker Hub
- docker push isaachats/myticket:latest
@Bukharee
Copy link

Bukharee commented Dec 8, 2022

pipelines: default: - step: name: Build and push Docker image image: docker:18.09.7 script: - docker build -t my-image . - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD - docker push my-image
the docker command is being used to build a Docker image named my-image from the Dockerfile in the root of the repository. The docker login command is then used to log in to the Docker registry using the DOCKER_USERNAME and DOCKER_PASSWORD environment variables, which you will need to set up in the Bitbucket settings for your repository. Finally, the docker push command is used to push the built image to the Docker registry.

@Bukharee
Copy link

Bukharee commented Dec 8, 2022

Try this let's see

@Bukharee
Copy link

Bukharee commented Dec 8, 2022

Format it to pattern of a yaml file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment