Skaffold: Skaffold fails to push to local private docker registry

Created on 22 Apr 2020  路  7Comments  路  Source: GoogleContainerTools/skaffold


I ran a local docker registry and would want to use it with skaffold so it can push images to it but it fails.

Expected behavior

It should be able to push to the local registry

Actual behavior

This fails with the error

Get http://localhost:5000/v2/: dial tcp 127.0.0.1:5000: connect: connection refused

Information

  • Skaffold version: 1.8.0
  • Operating system: macos
  • Contents of skaffold.yaml:
apiVersion: skaffold/v1beta15
kind: Config
build:
  tagPolicy:
    envTemplate:
      template: "{{.IMAGE_NAME}}:v1.0.0"
  artifacts:
  - image: rest-api
    context: ./rest-api
  - image: grafana
    context: ./grafana
  - image: prometheus
    context: ./prometheus
  local:
    push: true
deploy:
  kubectl:
    manifests:
     - kustomizer/minikube/deployments/*.yaml
     - kustomizer/minikube/services/*.yaml
     - kustomizer/minikube/configmaps/*.yaml
     - kustomizer/minikube/volumes/pvc/*.yaml
     - kustomizer/minikube/volumes/pv/*.yaml
profiles:
  - name: minikube
    activation:
      - kubeContext: minikube
    deploy:
      kubectl:
        manifests:
          - kustomizer/minikube/deployments/*.yaml
          - kustomizer/minikube/services/*.yaml
          - kustomizer/minikube/configmaps/*.yaml
          - kustomizer/minikube/volumes/pvc/*.yaml
          - kustomizer/minikube/volumes/pv/*.yaml

Steps to reproduce the behavior

  1. Clone https://github.com/raul1991/whatsapptracker
  2. docker run -d -p 5000:5000 --restart=always --name registry registry:2
  3. skaffold dev --port-forward --default-repo=localhost:5000
kinquestion

All 7 comments

It's not that simple, unfortunately. localhost is 127.0.0.1, which will refer to whichever host or container it is running on. It might work with --default-repo=$(ipconfig getifaddr en0) assuming the containers can reach your local host.

Since you seem to be using minikube, you can remove your local.push: true and Skaffold will automagically build and load images into the minikube's docker daemon.

It's not that simple, unfortunately. localhost is 127.0.0.1, which will refer to whichever host or container it is running on. It might work with --default-repo=$(ipconfig getifaddr en0) assuming the containers can reach your local host.

Since you seem to be using minikube, you can remove your local.push: true and Skaffold will automagically build and load images into the minikube's docker daemon.

You explanation was right.I was behind a proxy therefore the problem was occurring and fixing that made it all work fine.

Ok, That was bit hasty on my part to close this issue so reopening it so as to monitor it.

@rahulwa Is that ok to close this issue?

@dgageot I think you wrongly pinged me!

Yeah we can close it for now.

@dgageot I am having same issue when i try to push image for the second time. Even if i use minikube, I need to push it to my private docker registry to be used by my peers.

~/my-project $ skaffold build -p dev
Generating tags...
 - limbuu/codehub-image-11 -> limbuu/codehub-image-11:2020-05-12_17-54-16.096_NPT
 - limbuu/notebook-image-11 -> limbuu/notebook-image-11:2020-05-12_17-54-16.096_NPT
Checking cache...
 - limbuu/codehub-image-11: Found. Pushing
The push refers to repository [docker.io/limbuu/codehub-image-11]
92868cf8455a: Preparing 
c5b9a6dc2372: Preparing 
ae45da83e570: Preparing 
73dd52c49dc2: Preparing 
5488cb0044b1: Preparing 
d42e25626606: Waiting 
29d8009eb3b2: Waiting 
24fc98b01cb5: Waiting 
26f622d5cd17: Waiting 
0e7c76851ef2: Waiting 
c44a2f3b9903: Waiting 
8319336219be: Waiting 
52038114a0a1: Waiting 
7875aa31b6d1: Waiting 
76abdbbc6bda: Waiting 
8f66e6e7f9e1: Waiting 
4765129212b2: Waiting 
19bb1737cba8: Waiting 
0b900eb368ee: Waiting 
f5b3ec415301: Waiting 
acc98c301301: Waiting 
95a1bd860373: Waiting 
f563e0cf3a39: Waiting 
eaf5bc723114: Waiting 
77d6fbb3af3b: Waiting 
56a8428e59bb: Waiting 
1e76d8a1b08e: Waiting 
e0b3afb09dc3: Waiting 
6c01b5a53aac: Waiting 
2c6ac8e5063e: Waiting 
cc967c529ced: Waiting 
pushing image: denied: requested access to the resource is denied

Was this page helpful?
0 / 5 - 0 ratings