Managing Docker Registry with Docker Compose

As Docker Registry grows more complex, dealing with its configuration will be tedious. So it is highly recommended that you use Docker Compose. Docker Compose will be discussed later in Chapter 8, Orchestrating Containers.

The docker-compose.yml file is created as follows:

registry:
image: registry:2
ports:
- 5000:5000
environment:
REGISTRY_HTTP_TLS_CERTIFICATE: /certs/domain.crt
REGISTRY_HTTP_TLS_KEY: /certs/domain.key
REGISTRY_AUTH: htpasswd
REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
volumes:
- /path/data:/var/lib/registry
- /path/certs:/certs
- /path/auth:/auth

Now, run the command to run the registry:

$ sudo docker-compose up -d 
Creating ubuntu_registry_1

This ensures Docker Registry is up and running again.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset