Container registry metadata database for new installations

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab Self-Managed

Enable the container registry metadata database for your instance.

Enable the metadata database

Enable the metadata database for a new container registry.

Prerequisites:

  • You must have a new container registry with no images pushed to the registry. To enable the database:
  1. Enable the database by editing /etc/gitlab/gitlab.rb and setting enabled to true:

    registry['database'] = {
      'enabled' => true,
    }
  2. Save the file and reconfigure GitLab.

Prerequisites:

  • You must have a new container registry with no images pushed to the registry.
  • Create an external database.

To enable the database:

  1. Edit /etc/gitlab/gitlab.rb by adding your database connection details, but start with the metadata database disabled:

    registry['database'] = {
      'enabled' => false,
      'host' => '<registry_database_host_placeholder_change_me>',
      'port' => 5432, # Default, but set to the port of your database instance if it differs.
      'user' => '<registry_database_username_placeholder_change_me>',
      'password' => '<registry_database_placeholder_change_me>',
      'dbname' => '<registry_database_name_placeholder_change_me>',
      'sslmode' => 'require', # See the PostgreSQL documentation for additional information https://www.postgresql.org/docs/16/libpq-ssl.html.
      'sslcert' => '</path/to/cert.pem>',
      'sslkey' => '</path/to/private.key>',
      'sslrootcert' => '</path/to/ca.pem>'
    }
  2. Save the file and reconfigure GitLab.

  3. Apply database migrations.

  4. Enable the database by editing /etc/gitlab/gitlab.rb and setting enabled to true:

    registry['database'] = {
      'enabled' => true,
      'host' => '<registry_database_host_placeholder_change_me>',
      'port' => 5432, # Default, but set to the port of your database instance if it differs.
      'user' => '<registry_database_username_placeholder_change_me>',
      'password' => '<registry_database_placeholder_change_me>',
      'dbname' => '<registry_database_name_placeholder_change_me>',
      'sslmode' => 'require', # See the PostgreSQL documentation for additional information https://www.postgresql.org/docs/16/libpq-ssl.html.
      'sslcert' => '</path/to/cert.pem>',
      'sslkey' => '</path/to/private.key>',
      'sslrootcert' => '</path/to/ca.pem>'
    }

You can now use the metadata database for all operations!