title: How Do I Get Skaffold And Helm Charts To Work With A Local Image Repository?
body: <p>We're trying to set up a local development environment with several microservices app under Skaffold.  We managed to do it with base Skaffold, using a (slightly outdated) tutorial at <a href="https://github.com/ahmetb/skaffold-from-laptop-to-cloud" rel="noreferrer">https://github.com/ahmetb/skaffold-from-laptop-to-cloud</a>.  And to get Skaffold to push images to a local repository without Helm, all I had to do was set up the imageName to use something like localhost:5000/image_name.  </p>
  
  <p>But with Helm, well.... I set up a very crude Helm install (DISCLAIMER: I am not much familiar with Helm yet), just changing the skaffold YAML to use Helm and dumping all the .YAML deployment and service files into the Helm chart's /templates directory, and that bombed. </p>
  
  <p>Skaffold then successfully creates any pods that rely on a stock external image (like redis), but then whenever anything uses an image that would be generated from a local Dockerfile, it gets stuck and throws this error: </p>
  
  <blockquote>
    <p>Failed to pull image "localhost:5000/k8s-skaffold/php-test": rpc
    error: code = Unknown desc = Error response from daemon: Get
    <a href="http://localhost:5000/v2/" rel="noreferrer">http://localhost:5000/v2/</a>: dial tcp [::1]:5000: connect: connection
    refused</p>
  </blockquote>
  
  <p>As far as I can tell, that's the error that comes when we haven't initialized a local Docker image repository - but with the non-Helm version, we don't need to start up a local image repository, Skaffold just makes that magic happen.  Which is part of the appeal OF Skaffold.  </p>
  
  <p>So how do we automagically get Skaffold to create Helm charts that create and pull from a local repository?  (As noted, this may be my unfamiliarity with Helm. If so, I apologize.)  </p>
  
  <p>The Skaffold YAML is this: </p>
  
  <pre><code>apiVersion: skaffold/v1beta7
  kind: Config
  build:
    tagPolicy:
      sha256: {}
    artifacts:
    - image: localhost:5000/k8s-skaffold/php-test
      context: voting-app/php-test  
  deploy:
    helm:
      releases:
      - name: php-help-test
        chartPath: helm
        #wait: true
        #valuesFiles:
        #- helm-skaffold-values.yaml
        values:
          image: localhost:5000/k8s-skaffold/php-test
        #recreatePods will pass --recreate-pods to helm upgrade
        #recreatePods: true
        #overrides builds an override values.yaml file to run with the helm deploy
        #overrides:
        # some:
        #   key: someValue
        #setValues get appended to the helm deploy with --set.  
        #setValues:
          #some.key: someValue
  </code></pre>
  
  <p>And the Helm Chart values.yaml is the default provided by a generated chart.  I can also provide the Dockerfile if needed, but it's just pulling from that image.</p>