based on [kubernetes official documentation](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/)
## Log in docker
`$ docker login`
The login process creates or updates a config.json file that holds an authorization token.
View the `config.json` file:
`$ cat ~/.docker/config.json`
## Create a Secret based on existing Docker credentials
copy credential into Kubernetes
```
$ kubectl create secret generic regcred \
--from-file=.dockerconfigjson=<path/to/.docker/config.json> \
--type=kubernetes.io/dockerconfigjson
```
## Create a Secret by providing credentials on the command line
Create this Secret, naming it `regcred`:
```
kubectl create secret docker-registry regcred --docker-server=<your-registry-server> \
--docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>
```
- `<your-registry-server>` is your Private Docker Registry FQDN. (https://index.docker.io/v1/ for DockerHub)
- `<your-name>` is your Docker username.
- `<your-pword>` is your Docker password.
- `<your-email>` is your Docker email.
## Create a Pod that uses your Secret
Here is a configuration file for a Pod that needs access to your Docker credentials in `regcred`
``` yml
apiVersion: v1
kind: Pod
metadata:
name: private-reg
spec:
containers:
- name: private-reg-container
image: <your-private-image>
\!h imagePullSecrets:
\!h - name: regcred
```