GoogleContainerTools / skaffold

Easy and Repeatable Kubernetes Development
https://skaffold.dev/
Apache License 2.0
14.92k stars 1.62k forks source link

Skaffold can't push to remote private registry. #7231

Open da-nial opened 2 years ago

da-nial commented 2 years ago

Expected behavior

The image should be built and pushed to the remote registry.

Actual behavior

The output of skaffold run is as follows

WARN[0000] failed to detect active kubernetes cluster node platform. Specify the correct build platform in the skaffold.yaml file or using the --platform flag subtask=-1 task=DevLoop Generating tags...

  • registry.a.com:5000/b/c/d -> registry.a.com:5000/b/c/d:4.5.5-265-g0186190-dirty Checking cache...
  • registry.a.com:5000/b/c/d: Not found. Building Starting build... Building [registry.a.com:5000/b/c/d]... [+] Building 1.9s (12/12) FINISHED => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 38B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 34B 0.0s => [internal] load metadata for docker.repos.balad.ir/python:3.8 0.0s => [1/7] FROM docker.repos.k.com/python:3.8 0.0s => [internal] load build context 0.0s => => transferring context: 84.57kB 0.0s => CACHED [2/7] RUN apt update; apt install -y libev-dev 0.0s => CACHED [3/7] ADD requirements.txt /tmp/requirements.txt 0.0s => CACHED [4/7] RUN --mount=type=secret,id=ci-job-token git config --global credential.helper store && echo "https://gitlab-ci-token:$(cat 0.0s => CACHED [5/7] WORKDIR /home/Libero 0.0s => [6/7] ADD . . 0.1s => [7/7] RUN pybabel compile -d libero/translations 0.5s => exporting to image 1.3s => => exporting layers 1.3s => => writing image sha256:sha-ommitted-by-me-as-i-wasn't-sure-if-it's-confidentital-or-not 0.0s => => naming to registry.a.com:5000/b/c/d:4.5.5-265-g0186190-dirty 0.0s The push refers to repository [registry.a.com:5000/b/c/d] build [registry.a.com:5000/b/c/d] failed: could not push image "registry.a.com:5000/b/c/d:4.5.5-265-g0186190-dirty": An image does not exist locally with the tag: registry.a.com:5000/b/c/d

Information

apiVersion: skaffold/v2beta28
kind: Config
metadata:
  name: libero
build:
  local:
    useBuildkit: true
  artifacts:
    - image: registry.a.com:5000/b/c/d
      docker:
        dockerfile: Dockerfile
deploy:
  kubectl:
    manifests:
      - k8s/canary-real-estate/deployment.yaml

Steps to reproduce the behavior

I'm working with a private GitLab docker registry. I'm not sure which files I should provide, any tips are highly appreciated.

when I run docker image ls i can see the image registry.a.com:5000/b/c/d:4.5.5-265-g0186190-dirty has been created, so I have no idea why skaffold can't find this image and push it to the remote repository? I should also note that skaffold is working perfectly fine with some other repositories that I use with this registry. I have logged in to the Docker registry, and the command docker push registry.a.com:5000/b/c/d:4.5.5-265-g0186190-dirty successfully pushes my image to the registry. The strange thing is that when I run skaffold run on the exact same repository in another computer (MacOS Big Sur) Skaffold works fine.

tejal29 commented 2 years ago

@Danialzz Can you please re-run the command with -v=trace logs?

revero-doug commented 1 year ago

try invoking the command like KUBECONFIG="/dev/null" skaffold build

this seems to short circuit the logic that tries to detect if you're operating in a development context and pushes the images to their respective repos. FWIW I also had export SKAFFOLD_DETECT_MINIKUBE=false but that seemed to have no effect and is probably not necessary.