2017-11-17 23:33:41 +00:00
# Docker registry
This example demonstrates how to deploy a [docker registry ](https://github.com/docker/distribution ) in the cluster and configure Ingress enable access from Internet
## Deployment
First we deploy the docker registry in the cluster:
```console
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/docs/examples/docker-registry/deployment.yaml
```
2018-04-29 06:17:29 +00:00
!!! Important
2018-08-30 18:24:56 +00:00
**DO NOT RUN THIS IN PRODUCTION**
2017-11-17 23:33:41 +00:00
2018-08-30 18:24:56 +00:00
This deployment uses `emptyDir` in the `volumeMount` which means the contents of the registry will be deleted when the pod dies.
2017-11-17 23:33:41 +00:00
The next required step is creation of the ingress rules. To do this we have two options: with and without TLS
### Without TLS
Download and edit the yaml deployment replacing `registry.<your domain>` with a valid DNS name pointing to the ingress controller:
```console
wget https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/docs/examples/docker-registry/ingress-without-tls.yaml
```
2018-04-29 06:17:29 +00:00
!!! Important
2020-02-09 23:50:27 +00:00
Running a docker registry without TLS requires we configure our local docker daemon with the insecure registry flag.
2018-04-29 06:17:29 +00:00
2020-02-09 23:50:27 +00:00
Please check [deploy a plain http registry ](https://docs.docker.com/registry/insecure/#deploy-a-plain-http-registry )
2017-11-17 23:33:41 +00:00
### With TLS
Download and edit the yaml deployment replacing `registry.<your domain>` with a valid DNS name pointing to the ingress controller:
```console
wget https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/docs/examples/docker-registry/ingress-with-tls.yaml
```
Deploy [kube lego ](https://github.com/jetstack/kube-lego ) use [Let's Encrypt ](https://letsencrypt.org/ ) certificates or edit the ingress rule to use a secret with an existing SSL certificate.
### Testing
2017-11-19 17:25:50 +00:00
To test the registry is working correctly we download a known image from [docker hub ](https://hub.docker.com ), create a tag pointing to the new registry and upload the image:
2017-11-17 23:33:41 +00:00
```console
docker pull ubuntu:16.04
docker tag ubuntu:16.04 `registry.<your domain>/ubuntu:16.04`
docker push `registry.<your domain>/ubuntu:16.04`
```
Please replace `registry.<your domain>` with your domain.