The Registry is deployed as a container and accessible via port 5000. We define an environment variable called _VIRTUALHOST of the domain for our registry. Docker clients will use this domain to access the registry and push/pull images. By specifying a domain, a client can access multiple registries.
In this example our Docker registry is located at registry.test.training.katacoda.com. We'll use a proxy to map requests to our domain on port 80 to the Registry container running on port 5000.
docker run -d -e \ VIRTUAL_HOST=registry.test.training.katacoda.com \ -v /opt/registry/data:/var/lib/registry \ --name registry registry:2
Mounting the volume /var/lib/registry is important. This is where the Registry will store all of the pushed images. Mounting the directory will allow you to restart and upgrade the container in future.