|
| 1 | +--- |
| 2 | +title: Allow users to create repositories when pushing |
| 3 | +description: By default Docker Trusted Registry only allows pushing images to |
| 4 | + existing repositories. Learn how to change that. |
| 5 | +keywords: dtr, repository |
| 6 | +ui_tabs: |
| 7 | +- version: dtr-2.5 |
| 8 | + orhigher: true |
| 9 | +cli_tabs: |
| 10 | +- version: cli |
| 11 | +--- |
| 12 | + |
| 13 | +{% if include.ui %} |
| 14 | +{% if include.version=="dtr-2.5" %} |
| 15 | +By default DTR only allows pushing images if the repository exists, and you |
| 16 | +have write access to the repository. |
| 17 | + |
| 18 | +As an example, if you try to push to `dtr.example.org/library/java:9`, and the |
| 19 | +`library/java` repository doesn't exist yet, your push fails. |
| 20 | + |
| 21 | +You can configure DTR to allow pushing to repositories that don't exist yet. |
| 22 | +As an administrator, log into the **DTR web UI**, navigate to the **Settings** |
| 23 | +page, and enable **Create repository on push**. |
| 24 | + |
| 25 | +{: .with-border} |
| 26 | + |
| 27 | +From now on, when a user pushes to their personal sandbox |
| 28 | +(`<user-name>/<repository>`), or if the user is an administrator for the |
| 29 | +organization (`<org>/<repository>`), DTR will create a repository if it doesn't |
| 30 | +exist yet. In that case, the repository is created as private. |
| 31 | +{% endif %} |
| 32 | +{% endif %} |
| 33 | + |
| 34 | + |
| 35 | +{% if include.cli %} |
| 36 | +```bash |
| 37 | +curl --user <admin-user>:<password> \ |
| 38 | +--request POST "<dtr-url>/api/v0/meta/settings" \ |
| 39 | +--header "accept: application/json" \ |
| 40 | +--header "content-type: application/json" \ |
| 41 | +--data "{ \"createRepositoryOnPush\": true}" |
| 42 | +``` |
| 43 | +{% endif %} |
0 commit comments