Home > Software design >  Cannot push docker image into docker hub from Github Action
Cannot push docker image into docker hub from Github Action

Time:09-30

I have yaml file in GitHub action and i have successfully build docker image in it and i want to push into docker hub but getting below error

Run docker push ***/vampi_docker:latest
docker push ***/vampi_docker:latest
shell: /usr/bin/bash -e {0}
An image does not exist locally with the tag: ***/vampi_docker
The push refers to repository [docker.io/***/vampi_docker]
Error: Process completed with exit code 1.

Here is the yml file

name: vampi_docker
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: docker login
      env:
        DOCKER_USER: ${{secrets.DOCKER_USER}}
        DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
        repository: rashidmd/vampi_docker:latest
        tags: latest, ${{ secrets.DOCKER_TOKEN }}
      run: |
        docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
        
    - name: Build the Vampi Docker image
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
        docker build . --file Dockerfile --tag vampi_docker:latest
        
    - name: List images
      run: docker images    
    - name: Docker Push
      run: docker push ${{secrets.DOCKER_USER}}/vampi_docker:latest

Please do let me know where im wrong and what i miss

CodePudding user response:

Base on the error that is showed.

Change this:

docker build . --file Dockerfile --tag vampi_docker:latest

to:

docker build . --file Dockerfile --tag rashidmd/vampi_docker:latest

And run again.

  • Related