Docker Community Forums

Share and learn in the Docker community.

Docker login permission denied from private repo in Kubectl

Hi All,

I have few private repository in docker hub and i want to deploy it in my laptop below are the issue im getting when deploying images.

And all images have download but still issue having

root@master-node:/home/mohd/Music/Kuberentes/Kubernetes# kubectl create secret generic testdocker --from-file=.dockerconfigjson=/root/.docker/config.json --type=kubernetes.io/dockerconfigjson
The connection to the server 192.168.0.13:8443 was refused - did you specify the right host or port?
 kubectl create secret generic dockerlogin --from-file=.dockerconfigjson=/root/.docker/config.json --type=kubernetes.io/dockerconfigjson
error: error reading /root/.docker/config.json: permission denied
Failed to pull image "fxlabs/control-plane:latest": rpc error: code = Unknown desc = Error response from daemon: pull access denied for fxlabs/control-plane, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
 Error: ErrImagePull
 Error: ImagePullBackOff
 Back-off pulling image "imagename"

Please help me how to solve it

The problem is with the image pull policy - you have set this to Always (the default setting). This means that the Docker deamon always tries to pull the image from the outer Docker registry - you want to use the local one instead.

Try to add --image-pull-policy=Never when creating a deployment.

A good tutorial of using locally created images is here (it helped me):