Allow to configure Docker Registry via environment variables

Change-Id: Ida7b870e86894bd33e923ae1cc1142d32e052ddc
Story: 2004817
Task: 28982
This commit is contained in:
Pierre Riteau 2019-01-31 11:40:34 +00:00
parent 72b388009d
commit e642ba11b3
5 changed files with 47 additions and 0 deletions

View File

@ -5,6 +5,15 @@
# Whether a docker registry is enabled.
docker_registry_enabled: False
# Dict of environment variables to provide to the docker registry container.
# This allows to configure the registry by overriding specific configuration
# options, as described at https://docs.docker.com/registry/configuration/
# For example, the registry can be configured as a pull through cache to Docker
# Hub by setting REGISTRY_PROXY_REMOTEURL to "https://registry-1.docker.io".
# Note that it is not possible to push to a registry configured as a
# pull through cache.
docker_registry_env: {}
# The port on which the docker registry server should listen.
# NOTE: This is set to 4000 rather than the default of 5000 to avoid clashing
# with keystone.

View File

@ -8,10 +8,20 @@ docker_registry_action: deploy
# Whether a docker registry is enabled.
docker_registry_enabled: true
# Dict of environment variables to provide to the docker registry container.
# This allows to configure the registry by overriding specific configuration
# options, as described at https://docs.docker.com/registry/configuration/
# For example, the registry can be configured as a pull through cache to Docker
# Hub by setting REGISTRY_PROXY_REMOTEURL to "https://registry-1.docker.io".
# Note that it is not possible to push to a registry configured as a
# pull through cache.
docker_registry_env: {}
# Service deployment definition.
docker_registry_services:
docker_registry:
container_name: docker_registry
env: "{{ docker_registry_env }}"
enabled: "{{ docker_registry_enabled }}"
image: "{{ docker_registry_image_full }}"
ports:

View File

@ -1,6 +1,7 @@
---
- name: Ensure Docker registry container is running
docker_container:
env: "{{ item.value.env }}"
image: "{{ item.value.image }}"
name: "{{ item.value.container_name }}"
ports: "{{ item.value.ports | default(omit) }}"

View File

@ -5,6 +5,15 @@
# Whether a docker registry is enabled.
#docker_registry_enabled:
# Dict of environment variables to provide to the docker registry container.
# This allows to configure the registry by overriding specific configuration
# options, as described at https://docs.docker.com/registry/configuration/
# For example, the registry can be configured as a pull through cache to Docker
# Hub by setting REGISTRY_PROXY_REMOTEURL to "https://registry-1.docker.io".
# Note that it is not possible to push to a registry configured as a
# pull through cache.
#docker_registry_env:
# The port on which the docker registry server should listen.
#docker_registry_port:

View File

@ -0,0 +1,18 @@
---
features:
- |
Adds support for configuring the Docker Registry by providing environment
variables to its container via the ``docker_registry_env`` Ansible
variable. For example, the registry can be configured as a pull through
cache to Docker Hub using:
.. code-block:: text
docker_registry_env:
REGISTRY_PROXY_REMOTEURL: "https://registry-1.docker.io"
Note that it is not possible to push to a registry configured as a
pull through cache. See `story 2004817
<https://storyboard.openstack.org/#!/story/2004817>`__ for details and the
`Docker documentation <https://docs.docker.com/registry/configuration/>`__
for the full list of configuration options.