doc/administration/packages/container_registry_metadata_database_new_install.md
{{< details >}}
{{< /details >}}
Enable the container registry metadata database for your instance.
Enable the metadata database for a new container registry.
{{< tabs >}}
{{< tab title="GitLab 18.3 and later" >}}
Prerequisites:
To enable the database:
Enable the database by editing /etc/gitlab/gitlab.rb and setting enabled to true:
registry['database'] = {
'enabled' => true,
}
Save the file and reconfigure GitLab.
{{< /tab >}}
{{< tab title="GitLab 17.5 to 18.2" >}}
Prerequisites:
To enable the database:
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>'
}
Save the file and reconfigure GitLab.
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>'
}
{{< /tab >}}
{{< /tabs >}}
You can now use the metadata database for all operations!