-
Notifications
You must be signed in to change notification settings - Fork 553
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
Support pull-through caches #282
Comments
Can you post logs please?
If you are on GHE I assume you're running a self-hosted GitHub Runner. If that's the case you can configure {
"registry-mirrors": ["https://docker.artifactory.tri-ad.tech"]
} Or to increase your pull rate limits you can upgrade your account to a Docker Pro or Team subscription and add another Login step in your workflow to connect to Docker Hub: jobs:
python:
runs-on: self-hosted
name: Build Python ${{ matrix.python }}
strategy:
matrix:
python: ["3.8", "3.9"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: synced-actions/docker-login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: synced-actions/docker-setup-buildx-action@v1
- name: Login to Artifactory
uses: synced-actions/docker-login-action@v1
with:
registry: docker.artifactory.tri-ad.tech
username: ${{ secrets.ARTIFACTORY_USER }}
password: ${{ secrets.ARTIFACTORY_API_KEY }}
- name: Build and push
uses: synced-actions/docker-build-push-action@v2
with:
cache-from: type=registry,ref=user/app:latest
push: true
tags: repository/python-ci:${{ matrix.python }}
context: ./python-ci
file: ./python-ci/Dockerfile
build-args: |
PYTHON_VERSION=${{ matrix.python }} |
I have no access rights to manage the runner, so I can not change the runner configuration. Switching to a paid account is likewise not an option, since we already have a local registry that we should use instead of paying for an extra service that should not be needed. |
Ok so in this case you have to handle the FROM ubuntu:xenial-20201030 with ARG REGISTRY
FROM ${REGISTRY}ubuntu:xenial-20201030 and use the following workflow: jobs:
python:
runs-on: self-hosted
name: Build Python ${{ matrix.python }}
strategy:
matrix:
python: ["3.8", "3.9"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: synced-actions/docker-setup-buildx-action@v1
- name: Login to Artifactory
uses: synced-actions/docker-login-action@v1
with:
registry: docker.artifactory.tri-ad.tech
username: ${{ secrets.ARTIFACTORY_USER }}
password: ${{ secrets.ARTIFACTORY_API_KEY }}
- name: Build and push
uses: synced-actions/docker-build-push-action@v2
with:
cache-from: type=registry,ref=user/app:latest
push: true
tags: repository/python-ci:${{ matrix.python }}
context: ./python-ci
file: ./python-ci/Dockerfile
build-args: |
REGISTRY=dockerhub.artifactory.tri-ad.tech/
PYTHON_VERSION=${{ matrix.python }} |
@crazy-max to add to @wichert comments, we have already configured:
as as a pull-through cache, if we use |
@netcaptors Hum yes indeed, I think you need at least Docker 20.10 to support mirrors with containerd (moby/buildkit#1787). WDYT @tonistiigi? |
@crazy-max we are running Docker 20.10.7 as have a registry mirror configured yet the action is still pulling from Docker Hub directly. |
Sorry for the delay. It seems you're running a builder using the jobs:
python:
runs-on: self-hosted
name: Build Python ${{ matrix.python }}
strategy:
matrix:
python: ["3.8", "3.9"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Create buildkitd conf
run: |
cat > /tmp/buildkitd.toml <<EOL
[registry."docker.io"]
mirrors = ["docker.artifactory.tri-ad.tech"]
EOL
- name: Set up Docker Buildx
uses: synced-actions/docker-setup-buildx-action@v1
with:
config: /tmp/buildkitd.toml
- name: Login to Artifactory
uses: synced-actions/docker-login-action@v1
with:
registry: docker.artifactory.tri-ad.tech
username: ${{ secrets.ARTIFACTORY_USER }}
password: ${{ secrets.ARTIFACTORY_API_KEY }}
- name: Build and push
uses: synced-actions/docker-build-push-action@v2
with:
cache-from: type=registry,ref=user/app:latest
push: true
tags: repository/python-ci:${{ matrix.python }}
context: ./python-ci
file: ./python-ci/Dockerfile
build-args: |
REGISTRY=dockerhub.artifactory.tri-ad.tech/
PYTHON_VERSION=${{ matrix.python }} I will add some documentation on setup-buildx-action repo. I also think I will add an inline config input for the setup-buildx-action to avoid creating the file in a dedicated step. |
Documentation available: https://github.com/docker/setup-buildx-action#registry-mirror |
Troubleshooting
Before sumbitting a bug report please read the Troubleshooting doc.
Behaviour
Steps to reproduce this issue
Expected behaviour
Be able to use an existing Artifactory instance as a pull-through cache.
Actual behaviour
No cache ability, causing us to hit rate limits.
Please note that
synced-actions/docker-login-action
andsynced-actions/docker-build-push-action
are synced copies of the official actions, running on a GHE instance.The text was updated successfully, but these errors were encountered: