Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker login into kube cluster

I've create a private repo on docker hub and trying to pull that image into my kubernetes cluster. I can see the documentations suggest to do this

kubectl create secret generic regcred \ --from-file=.dockerconfigjson=<path/to/.docker/config.json> \ --type=kubernetes.io/dockerconfigjson

I am already logged in, and i change path to ~/.docker/config.json but it keeps giving me

error: error reading ~./docker/config.json: no such file or directory

despite the fact if i type cat ~/.docker/config.json it displays the content, meaning there is a file.

So in other words how to properly authenticate and be able to push private images into kube cluster?

like image 899
Liniaq Avatar asked Mar 13 '19 05:03

Liniaq


1 Answers

error: error reading ~./docker/config.json: no such file or directory
                     ^^^^ ?

~./docker/config.json does not seem valid:
~/.docker/config.json would

To remove any doubt, try the full path instead of ~:

kubectl create secret generic regcred \
    --from-file=.dockerconfigjson=/home/auser/.docker/config.json \
    --type=kubernetes.io/dockerconfigjson
like image 97
VonC Avatar answered Sep 18 '22 06:09

VonC