Pull a local image to run a pod in Kubernetes

I have the following image created by a Dockerfile:


  • How use my docker-compose configuration with gitlab CI
  • Can docker containers be run on live web servers?
  • AWS Elastic Beanstalk with single container docker: Logging parameter in Dockerfile.aws.json
  • Docker-compose recommended way to use data containers
  • docker + apt-add-repository: 'ascii' codec can't decode byte
  • Build docker image fail : Exiting on user command
  • ruby/lab latest f1903b1508cb 2 hours ago 729.6 MB

    And I have my following YML file:

    apiVersion: extensions/v1beta1
    kind: Deployment
      name: ruby-deployment
      replicas: 2
            app: ruby
          - name: ruby-app
            image: ruby/lab
            imagePullPolicy: IfNotPresent
            - containerPort: 4567

    When I create the deployment I got the following info in the pods:

    ruby-deployment-3830038651-sa4ii   0/1       ImagePullBackOff   0          7m
    ruby-deployment-3830038651-u1tvc   0/1       ImagePullBackOff   0          7m


     8m            2m              6       {kubelet minikube}      spec.containers{ruby}   Normal          Pulling         pulling image "ruby/lab:latest"
      8m            2m              6       {kubelet minikube}      spec.containers{ruby}   Warning         Failed          Failed to pull image "ruby/lab:latest": Error: image ruby/lab not found
      8m            2m              6       {kubelet minikube}                              Warning         FailedSync      Error syncing pod, skipping: failed to "StartContainer" for "ruby" with ErrImagePull: "Error: image ruby/lab not found"

    Is really necessary to have registry in docker for this? I just want to make test locally and pass my code/repo to a friend for testing purposes


  • Hyperledger on mac using Docker images cannot find Docker daemon?
  • Cannot stop or restart a docker container
  • How to manage many hosts with shipyard
  • fig up: docker containers start synchronisation
  • why I can't ping my docker container?
  • Docker build unable to install pg gem in Sinatra project
  • 3 Solutions collect form web for “Pull a local image to run a pod in Kubernetes”

    You can point your docker client to the VM’s docker daemon by running

    eval $(minikube docker-env)

    Then you can build your image normally and create your kubernetes resources normally using kubectl. Make sure that you have

    imagePullPolicy: IfNotPresent

    in your YAML or JSON specs.

    Additionally, you can there is a flag to pass in insecure registries into the minikube VM. However, this must be specified the first time you create the machine.

    minikube start --insecure-registry

    You may also want to read this when using a private registry

    AFAIR minikube runs in a VM hence it will not see the images you’ve built locally on a host machine, but… as stated in https://github.com/kubernetes/minikube/blob/master/README.md#reusing-the-docker-daemon you can use eval $(minikube docker-env) to actually utilise docker daemon running on minikube, and henceforth build your image on the minikubes docker and thus expect it to be available to the minikubes k8s engine without pulling from external registry

    Please refer to the documentation on images, or the answer here.

    Each container in a pod has its own image. Currently, the only type of image supported is a Docker Image.
    You create your Docker image and push it to a registry before referring to it in a Kubernetes pod.
    The image property of a container supports the same syntax as the docker command does, including private registries and tags.

    You can push to a public docker registry or use your own private repository. There may be a way to make minikube pick up locally built images but it is going to be certainly easier to push the docker image to a registry.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.