timesheets avatar

Using Private Docker Registry with Skaffold

timesheets

Published: 11 Oct 2022 › Updated: 11 Oct 2022Using Private Docker Registry with Skaffold

Using Private Docker Registry with Skaffold

When doing a skaffold build, skaffold will attempt to verify artifacts created. Artifacts are images, so it will check to see if the artifact is there or not. There is nothing you can do about this. Honestly, I would not want to. This is a reasonable assumption that if you create an artifact, check if it got created. The trouble is that skaffold wants to work mostly with docker.io or public docker registries. It does not give much in the way of supporting private or secure registries. See below:

 skaffold build  --cache-artifacts=false
Generating tags...
 - registry.localhost/repo/project -> registry.localhost/repo/project:latest
Starting build...
Checking for kaniko secret [default/regcred]...
Creating docker config secret [regcred]...
Building [registry.localhost/repo/project]...
job.batch/project-buildkit-base created
getting image: GET https://registry.localhost/repo/project/manifests/latest: nexpected status code 401 Unauthorized: 401 Unauthorized

What can then be done? Luckily, skaffold does not require docker to be installed or I would be in trouble. I do not use docker. I use containerd and buildkit. Docker would be the end for me. Instead, skaffold only requires that ~/.docker/config.json have your credentials in it. That is easily fixed. Kubernetes already has my docker config as a secret.

kubectl get secret regcred -o yaml | grep dockerconfigjson | head -1 | cut -d ' ' -f 4 | base64 -d > ~/.docker/config.json

Now I can run skaffold build with no problem.

Leave Using Private Docker Registry with Skaffold to:

Written by

Read more #blog posts


Best Posts From timesheets

We have not curated any of timesheets's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From timesheets