Allow users to create repositories when pushing

Estimated reading time: 1 minute

This topic applies to Docker Enterprise.

The Docker Enterprise platform business, including products, customers, and employees, has been acquired by Mirantis, inc., effective 13-November-2019. For more information on the acquisition and how it may affect you and your business, refer to the Docker Enterprise Customer FAQ.

By default DTR only allows pushing images if the repository exists, and you have write access to the repository.

As an example, if you try to push to dtr.example.org/library/java:9, and the library/java repository doesn’t exist yet, your push fails.

You can configure DTR to allow pushing to repositories that don’t exist yet. As an administrator, log into the DTR web UI, navigate to the Settings page, and enable Create repository on push.

DTR settings page

From now on, when a user pushes to their personal sandbox (<user-name>/<repository>), or if the user is an administrator for the organization (<org>/<repository>), DTR will create a repository if it doesn’t exist yet. In that case, the repository is created as private.

Use the CLI to enable pushing to repositories that don’t exist yet

curl --user <admin-user>:<password> \
--request POST "<dtr-url>/api/v0/meta/settings" \
--header "accept: application/json" \
--header "content-type: application/json" \
--data "{ \"createRepositoryOnPush\": true}"
dtr, repository