<p>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</p>

<p><code>
kubectl create secret generic regcred \
    --from-file=.dockerconfigjson=&lt;path/to/.docker/config.json&gt; \
    --type=kubernetes.io/dockerconfigjson
</code></p>

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

<p><code>error: error reading ~./docker/config.json: no such file or directory</code> </p>

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

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

<blockquote>
<pre><code>error: error reading ~./docker/config.json: no such file or directory
                     ^^^^ ?
</code></pre>
</blockquote>

<p><code>~./docker/config.json</code> does not seem valid:<br>
<code>~/.docker/config.json</code> would</p>

<p>To remove any doubt, try the full path instead of <code>~</code>:</p>

<pre><code>kubectl create secret generic regcred \
    --from-file=.dockerconfigjson=/home/auser/.docker/config.json \
    --type=kubernetes.io/dockerconfigjson
</code></pre>
