Kubernetes Docker Hub Private

7/13/2018

I am using Minikube to setup a k8s environment for later production but I can't figure out how to pull private container from Docker Hub in my service definition.

I added

imagePullSecrets:
    - name: dockerregistrykey

to the service definition spec.template.spec and the dockerregistrykey to the secrets.

But I am still getting this error

Failed to pull image "keyshake/transaction_service:latest": rpc error: code = Unknown desc = Error response from daemon: pull access denied for keyshake/transaction_service, repository does not exist or may require 'docker login'

Thanks in advance.

-- Theo Bouwman
docker
dockerhub
kubernetes

1 Answer

7/13/2018

You need to declare the use of the pullSecret at container level:

...
spec:
  containers:
    - name: my_container
      image: your_image
  imagePullSecrets:
    - name: dockerregistrykey
-- Nicola Ben
Source: StackOverflow