<p>I've a private repo on gitlab, this repo is synchronized with docker and trying to pull that image into my kubernetes cluster. I can see the documentations suggest to do this</p>
<pre><code>kubectl create secret generic regcred \
    --from-file=.dockerconfigjson=&lt;path/to/.docker/config.json&gt; \
    --type=kubernetes.io/dockerconfigjson
</code></pre>
<p>I am already logged in, and i change path to ~/.docker/config.json but it keeps giving me</p>
<pre><code>kubectl create secret generic regcred --from-file=.dockerconfigjson=&lt;~/.docker/config.json&gt; --type=kubernetes.io/dockerconfigjson

bash: --type=kubernetes.io/docker config json: No such file or directory
</code></pre>
<p>Do you know how to resolve this error?</p>
<p>So in other words how to properly authenticate and be able to push private images into kube cluster?</p>
<p>Thanks,</p>

guillaumed4sii
<p>I know you've copied it from the official docs, but it may be missing quotes. Also build a path using <code>$HOME</code> var. Try this:</p>
<pre><code>kubectl create secret generic regcred \
    --from-file=.dockerconfigjson=&quot;$HOME/.docker/config.json&quot; \
    --type=&quot;kubernetes.io/dockerconfigjson&quot;
</code></pre>
