Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Docker profile


May 22, 2021 Docker From entry to practice



Docker's Registry uses profiles to provide templates (flavors) for some repositories that users can use directly for development or production deployments.

Template

In config_sample.yml you can see some out-of-the-way template segments:

  • common The underlying configuration
  • local Stores data to the local file system
  • s3 Store data into AWS S3
  • dev Use the basic configuration of the local template
  • test Unit tests are used
  • prod Production 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 a back-up
  • glance-swift Store data to the OpenStack Glance service, with Swift as a backup
  • elliptics Store data to Elliptics key/value storage

Users can also add custom template segments.

The template used by dev and to use a template as the default, SETTINGS_FLAVOR to an environment variable, for example

export SETTINGS_FLAVOR=dev

In addition, the configuration file supports loading values from environment variables in the syntax format _env:VARIABLENAME[:DEFAULT]

The 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: [email protected]
    to_addr: my@myself.com

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

test:
    storage: local
    storage_path: /tmp/tmpdockertmp

Options