Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note to sanitize tags #426

merged 1 commit into from Aug 5, 2021


Copy link

@crazy-max crazy-max commented Aug 5, 2021

Closes #424

Signed-off-by: CrazyMax

Signed-off-by: CrazyMax <>
@crazy-max crazy-max merged commit 6484a61 into docker:master Aug 5, 2021
@crazy-max crazy-max deleted the doc-sanitize-ref branch August 5, 2021 06:12
Copy link

Just a note - and maybe I was doing it wrong somehow - but this didn't actually work for me. I kept getting:


I ended up using:

- name: lowercase repo name for tag
        uses: ASzc/change-string-case-action@v1
        id: reponame
          string:${{ github.repository }}

and referencing as : ${{ steps.reponame.outputs.lowercase }}

Copy link
Member Author

@PromoFaux Looking at your workflow, I suggest to use the metadata action which will automatically sanitize tags:

name: Docker

    branches: main

    runs-on: ubuntu-latest
      - name: Checkout
        uses: actions/checkout@v2

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

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1

      - name: Cache Docker layers
        uses: actions/cache@v2.1.6
          path: /tmp/.docker-buildx-cache
          key: ${{ runner.os }}-docker-buildx-${{ github.sha }}
          restore-keys: ${{ runner.os }}-docker-buildx-

      - name: Login to Github Packages
        uses: docker/login-action@v1
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Docker meta
        id: meta
        uses: docker/metadata-action@v3
          images:${{ github.repository }}
          tags: |
            sha_${{ github.sha }}

      - name: Build
        id: docker_build
        uses: docker/build-push-action@v2
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          cache-from: type=local,src=/tmp/.docker-buildx-cache
          cache-to: type=local,dest=/tmp/.docker-buildx-cache

Copy link

Thanks for the tips, I'll take a look!

Copy link
Member Author


but this didn't actually work for me.

And yes indeed there is an issue with the syntax. It should be: script: return '${{ github.repository }}'.toLowerCase(). Will fix that in a follow-up and also add a note about the metadata action to sanitize tags.

Copy link

AH. I came really close to that solution myself! Rather I tried ${{ github.repository.toLowerCase() }}, which also didn't work - so I gave up and found another action. I'm not lazy, honest.

Copy link

Also, yeah, metadata action works well! I am already using it over on pi-hole/docker-pi-hole - I don't know why I didn't use it in this case.

Copy link
Member Author

Yeah you can do a bunch of thing with the metadata-action. For example you could merge both nightly and release workflows and the metadata action will take care of tagging properly based on scheduled events, git tag and so on.

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

Successfully merging this pull request may close these issues.

Repository/image name should be lowercased automatically in cache parameters.
2 participants