Docker tutorial on the warehouse configuration file details

  • 2020-05-30 21:42:19
  • OfStack

Docker warehouse configuration file

Docker's Registry leverages configuration files to provide templates for warehouses (flavor) that users can use directly for development or production deployment.

The template

In the config_sample.yml file, you can see some ready-made template segments:

common: basic configuration local: stores data to the local file system s3: stores data to AWS S3 dev: basic configuration using local templates test: used for unit testing prod: production environment configuration (basically similar to s3 configuration) gcs: store data to Google's cloud storage swift: stores data to the OpenStack Swift service glance: stores data to the OpenStack Glance service, with the local file system as backup glance-swift: stores data to OpenStack Glance service, Swift as backup elliptics: store data to Elliptics key/value

Users can also add custom template segments.

The template used by default is dev. To use a template as the default, you can add SETTINGS_FLAVOR to an environment variable, for example


export SETTINGS_FLAVOR=dev

In addition, loading values from environment variables is supported in the configuration file with the syntax _env:VARIABLENAME[:DEFAULT].

Sample configuration


common:
  loglevel: info
  search_backend: "_env:SEARCH_BACKEND:"
  sqlalchemy_index_database:
    "_env:SQLALCHEMY_INDEX_DATABASE:sqlite:////tmp/docker-registry.db"

prod:
  loglevel: warn
  storage: s3
  s3_access_key: _env:AWS_S3_ACCESS_KEY
  s3_secret_key: _env:AWS_S3_SECRET_KEY
  s3_bucket: _env:AWS_S3_BUCKET
  boto_bucket: _env:AWS_S3_BUCKET
  storage_path: /srv/docker
  smtp_host: localhost
  from_addr: docker@myself.com
  to_addr: my@myself.com

dev:
  loglevel: debug
  storage: local
  storage_path: /home/myself/docker

test:
  storage: local
  storage_path: /tmp/tmpdockertmp



Thank you for reading, I hope to help you, thank you for your support of this site!


Related articles: