Cannot push docker image to Google Artifact Registry
See original GitHub issueHi,
I’ve got quite a simple workflow using build-push-action v2, but I am unfortunately unable to push image successfully to Google Artifact Registry.
Here is the workflow:
name: CI
on:
push:
tags:
- 'v*.*.*'
env:
REGISTRY: europe-west4-docker.pkg.dev
PROJECT_ID: xxx
REPOSITORY_ID: appconfig
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare
id: prepare
run: |
DOCKER_IMAGE="${REGISTRY}/${PROJECT_ID}/${REPOSITORY_ID}"
VERSION=${GITHUB_REF#refs/tags/}
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
MINOR=${VERSION%.*}
MAJOR=${MINOR%.*}
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR},${DOCKER_IMAGE}:${MAJOR},${DOCKER_IMAGE}:latest"
elif [ "${{ github.event_name }}" = "push" ]; then
TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}"
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: --debug
- name: Login to GCR
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: _json_key
password: ${{ secrets.GCP_SA_KEY }}
- name: Build and push
id: docker-build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
target: bin
push: true
tags: ${{ steps.prepare.outputs.tags }}
It is failing with:
#10 pushing layers
#10 pushing layers 3.2s done
#10 pushing manifest for europe-west4-docker.pkg.dev/xxx/appconfig:v0.1.0
#10 pushing manifest for europe-west4-docker.pkg.dev/xxx/appconfig:v0.1.0 0.4s done
#10 ERROR: failed commit on ref "manifest-sha256:39c07bc2a80624b0ae6bb3c7a616b31a4ea846f8d679aca8835702328c57dccb": unexpected status: 400 Bad Request
------
> exporting to image:
------
failed to solve: rpc error: code = Unknown desc = failed commit on ref "manifest-sha256:39c07bc2a80624b0ae6bb3c7a616b31a4ea846f8d679aca8835702328c57dccb": unexpected status: 400 Bad Request
I tried to debug it using a troubleshooting note, but it seems that ctr accepts only docker login and password, but not GCP’s service account JSON file.
Here is a full log of workflow: 1_docker.txt.zip
Issue Analytics
- State:
- Created 3 years ago
- Comments:18 (8 by maintainers)
Top Results From Across the Web
Cannot push an image to Google Docker Artifact Registry #50
TL;DR. Replaced the use of https://github.com/docker/login-action with the current action to authenticate to a Google Docker Artifact registry ...
Read more >Push and pull images | Artifact Registry documentation
Go to the Google Cloud console to view the image. · Run the gcloud command to view the image's tags and automatically-generated digest:...
Read more >Service Account Unable to Push Docker Image to Google ...
I am trying to push a Docker image to Google Artifact Registry (GAR) while impersonating a Service Account ( $SERV_ACCT_EMAIL ):.
Read more >Unable to push docker image into GCP container registry ...
It is likely that your account doesn't have permission to store/write the docker image in GCR. The GCR in GCP is backed by...
Read more >New docker images cannot be pushed to Artifact Registry ...
When trying to push an image from our CI system using Kaniko, we get the following error: Pushing image to europe-west1-docker.pkg.dev/[ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jacek-jablonski I believe you need a third path component:
e.g. europe-west4-docker.pkg.dev/xxx/something-else/node:14.13.1-2
For anyone coming along in 2022+ looking to get this working in Google Artifact Registry, here’s one that will work if you have the appropriate secrets defined (GCP_PROJECT_ID for your Google Cloud project ID and GCP_SA_KEY with the base64 encoded service account JSON):