Skip to main content

GitHub Action: docker-image-exists

Check if docker image exists by pulling it

Usage

  name: Push into main branch
on:
push:
branches: [ master ]

jobs:
context:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Check image
id: image_exists
uses: cloudposse/github-action-docker-image-exists@main
with:
registry: registry.hub.docker.com
organization: "${{ github.event.repository.owner.login }}"
repository: "${{ github.event.repository.name }}"
login: "${{ secrets.DOCKERHUB_USERNAME }}"
password: "${{ secrets.DOCKERHUB_PASSWORD }}"
tag: latest

outputs:
result: ${{ steps.image_exists.conclusion }}
image: ${{ steps.image_exists.outputs.image }}
tag: ${{ steps.image_exists.outputs.tag }}

Inputs

NameDescriptionDefaultRequired
image_nameImage name (excluding registry). Defaults to {{$organization/$repository}}.false
loginDocker loginfalse
organizationOrganizationN/Atrue
passwordDocker passwordfalse
registryDocker registryN/Atrue
repositoryRepositoryN/Atrue
tagTagN/Atrue

Outputs

NameDescription
imageDocker image name
tagDocker image tag