Accessing private Docker Hub repository from Kubernetes on Vagrant

0 votes

I am using kubernetes 1.2.0. I am trying to pull image from my docker hub repo into my local kubernetes on vagrant:

Container "hellonode" in pod "hellonode-n1hox" is waiting to start: image can't be pulled

Failed to pull image "username/hellonode": Error: image username/hellonode:latest not found

I am using kubernetes locally on my vagrant machine and created a secret named "dockerhub". i supply this secret as the image pull secret.

Sep 18, 2018 in Kubernetes by Atul
• 10,240 points

1 answer to this question.

0 votes

In order to pull private dockerhub hosted images using kubernetes yaml use:
DOCKER_USER=Type your dockerhub username, same as when you `docker login`
DOCKER_EMAIL=Type your dockerhub email, same as when you `docker login`
DOCKER_PASSWORD=Type your dockerhub pw, same as when you `docker login`

kubectl create secret docker-registry myregistrykey \
  --docker-server=$DOCKER_REGISTRY_SERVER \
  --docker-username=$DOCKER_USER \
  --docker-password=$DOCKER_PASSWORD \

This is what your yaml file should look like:

apiVersion: v1
kind: Pod
  name: whatever
    - name: whatever
      imagePullPolicy: Always
      command: [ "echo", "SUCCESS" ]
    - name: myregistrykey

Then execute:

kubectl create -f example.yaml
answered Sep 18, 2018 by DareDev
• 6,870 points

Related Questions In Kubernetes

0 votes
2 answers
0 votes
2 answers

run private docker images on Google Container Engine

run docker login on minions before starting.  ...READ MORE

answered Aug 30, 2018 in Kubernetes by Nilesh
• 6,980 points
0 votes
1 answer

Accessing remote kubernetes cluster on azure using kubectl

So, try this. Edit your kube config ...READ MORE

answered Sep 11, 2018 in Kubernetes by ajs3033
• 7,280 points
0 votes
1 answer

nnot set docker credentials on kubernetes AWS

The best method for you is ImagePullSecrets - you ...READ MORE

answered Oct 9, 2018 in Kubernetes by Kalgi
• 51,970 points
+1 vote
1 answer
+2 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Cannot connect unix:///var/run/docker.sock in kubernetes using GitLab CI runner

Do not use this: DOCKER_DRIVER: overlay because OVERLAY is ...READ MORE

answered Oct 16, 2018 in Kubernetes by DareDev
• 6,870 points