Push to Container Registry stuck in waiting

Hi there!

I’m trying to dockerize a Rails app. I’ve been able to successfully build my docker image and push it to the GitHub Packages Registry. Then I read about the new Container Registry and tried to convert my workflow to push to the Github Container instead using GitHub’s own guide

I’m using a workflow from github’s community workflows repository. My workflow looks like this:

name: Docker Push

      - master

  IMAGE_NAME: samenameasrepositoy

  # Push image to GitHub Packages.
  # See also https://docs.docker.com/docker-hub/builds/
    # Ensure test job passes before pushing image.
    # needs: test # later...

    runs-on: ubuntu-latest
    if: github.event_name == 'push'

      - uses: actions/checkout@v2

      - name: Build image
        run: docker build . --file Dockerfile --tag $IMAGE_NAME

      - name: Log into registry
        run: echo "$CR_PAT" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

      - name: Push image
        run: |
          IMAGE_ID=ghcr.io/${{ github.repository }}

          # Change all uppercase to lowercase
          IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')

          # Strip git ref prefix from version
          VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')

          # Strip "v" prefix from tag name
          [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')

          # Use Docker `latest` tag convention
          [ "$VERSION" == "master" ] && VERSION=latest

          echo IMAGE_ID=$IMAGE_ID
          echo VERSION=$VERSION

          docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
          docker push $IMAGE_ID:$VERSION

The workflow seems to successfully authenticate with the Registry and begins pushing, however after the first few parts the push gets stuck at waiting. Restarting the workflow, or triggering a new workflow with a new commit to master don’t seem to help. See the attached screenshot, I canceled the workflow after it had been running for over 40 minutes. (This was taken at the 2nd attempt, hence the Layer Already Exists) When pushing to the Package Registry, the entire workflow took only 7 minutes.

This is from a private repository belonging to my user account, not belonging to an organisation.

1 Like

Hi, maybe you could adapt this action to your needs ?

name: Build and publish docker images 

      - master
    if: "!contains(github.event.head_commit.message, 'skip ci')"
    name: Build and publish
    runs-on: ubuntu-latest
    - uses: actions/checkout@v2
    - name: Get short SHA
      id: slug
      run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"

    - name: Get branch name
      run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
    - name: Get repository variable in lowercase
      run: echo "REPOSITORY=$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')" >> $GITHUB_ENV

    - name: Set up QEMU
      uses: docker/setup-qemu-action@v1

    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v1
    - name: Login to GitHub Container Registry
      uses: docker/login-action@v1
        registry: ghcr.io
        username: ${{ github.repository_owner }}
        password: ${{ secrets.CR_PAT }}

    - name: Push to GitHub Container Registry
      uses: docker/build-push-action@v2
        context: .
        push: true
        tags: ghcr.io/${{ env.REPOSITORY }}:${{ env.BRANCH_NAME }}