Now that your registry works on localhost, you probably want to make it available as well to other hosts.
Let assume your registry is accessible via the domain name `myregistrydomain.com` (still on port `5000`).
If you try to `docker pull myregistrydomain.com:5000/batman/ubuntu`, you will see the following error message:
```
FATA[0000] Error response from daemon: v1 ping attempt failed with error: Get https://nonregistry:5000/v1/_ping: dial tcp: lookup nonregistry: no such host. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry nonregistry:5000` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/nonregistry:5000/ca.crt
```
You basically have three different options to comply with docker security requirements here.
### 1. buy a SSL certificate for your domain
This is the (highly) recommended solution.
You can buy a certificate for as cheap as 10$ a year (some registrars even offer certificates for free), and this will save you a lot of trouble.
Assuming you now have a `domain.crt` and `domain.key` inside a directory named `certs`:
- work without further ado (assuming you bought your certificate from a CA that is trusted by your operating system)
**Cons:**
- ?
### 2. instruct docker to trust your registry as insecure
This basically tells Docker to entirely disregard security for your registry.
1. edit the file `/etc/default/docker` so that there is a line that reads: `DOCKER_OPTS="--insecure-registry myregistrydomain:5000"` (or add that to existing `DOCKER_OPTS`)
2. restart your Docker daemon: on ubuntu, this is usually `service docker stop && service docker start`
**Pros:**
- easy to configure
**Cons:**
- very insecure
- you have to configure every docker daemon that wants to access your registry
Be sure to use the name `myregistrydomain.com` as a CN.
Now go to solution 1 above and stop and restart your registry.
Then you have to instruct every docker daemon to trust that certificate. This is done by copying the `domain.crt` file to `/etc/docker/certs.d/myregistrydomain.com:5000/ca.crt`
**Pros:**
- more secure than solution 2
**Cons:**
- you have to configure every docker daemon that wants to access your registry
## Using Compose
It's highly recommended to use Docker Compose to facilitate managing your Registry configuration.
Here is a simple `docker-compose.yml` that does setup your registry exactly as above, with TLS enabled.