Docker login into kube cluster

3/13/2019

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?

-- Liniaq
docker
kubernetes

1 Answer

3/13/2019
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
-- VonC
Source: StackOverflow