Creating a Repository

Using Oracle Cloud Infrastructure Registry, you can create an empty repository in a compartment and give it a name that's unique across all compartments in the entire tenancy.

Having created the new repository, you can push an image to the repository using the Docker CLI (see Pushing Images Using the Docker CLI). Any images you subsequently push to the registry that include the same repository name are grouped into that repository.

Note that creating an empty repository in advance of pushing an image is almost certainly going to be your normal workflow. And if you're only authorized to manage repositories in compartments and not in the tenancy's root compartment, you'll always have to create a repository before pushing an image. However, if you're in the unusual position of mostly intending to push images to the root compartment, creating an empty repository in advance is not strictly necessary. For more information, see Notes about Repository Creation.

Using the Console

To create a repository in Oracle Cloud Infrastructure Registry:

  1. In the Console, open the navigation menu. Under Solutions and Platform, go to Developer Services and click Container Registry.
  2. Choose the region in which to create the repository.
  3. Choose a Compartment you have permission to work in.
  4. Click Create Repository.
  5. In the Create Repository dialog box, specify details for the new repository:

    • Compartment: The compartment in which to create the new repository. The default compartment is the one you selected previously, but you can select any compartment that you have permission to work in.
    • Repository Name: A name of your choice for the new repository. The name you enter must be unique across all compartments in the entire tenancy. Avoid entering confidential information.
    • Public: Whether the new repository will be a public repository or a private repository. You can only make the new repository public if you belong to the tenancy's Administrators group or have been granted the REPOSITORY_MANAGE permission. If you make the new repository public, any user with internet access and knowledge of the appropriate URL will be able to pull images from the repository. If you make the repository private, you (along with users belonging to the tenancy's Administrators group) will be able to perform any operation on the repository.
  6. Click Create Repository.
  7. (Optional) If you want to automatically create new private repositories in the tenancy's root compartment when docker push commands don't include the name of an existing repository:
    1. Click Settings, and then select General.
    2. Select Create repositories on first push in root compartment to automatically create a new private repository in the tenancy's root compartment if the repository referenced in a docker push command doesn't already exist.

    For more information about creating a new repository if the repository referenced in a docker push command doesn't already exist, see Notes about Repository Creation.

Using the CLI

For information about using the CLI, see Command Line Interface (CLI). For a complete list of flags and options available for CLI commands, see the Command Line Reference.

To create a repository

oci artifacts container repository create --display-name <repo-name> --compartment-id <compartment_ocid>
For example:
oci artifacts container repository create --display-name project01/acme-web-app --compartment-id ocid1.compartment.oc1..aaaaaaaarvdfa72n...

Notes about Repository Creation

Creating an empty repository in advance of pushing an image is almost certainly going to be your normal workflow. And if you're only authorized to manage repositories in compartments and not in the tenancy's root compartment, you'll always have to create a repository before pushing an image. However, if you're in the unusual position of mostly intending to push images to the tenancy's root compartment, creating an empty repository in advance is not strictly necessary.

When you push an image, you normally use a command in the format docker push <region-key>.ocir.io/<tenancy-namespace>/<repo-name>:<tag>. However, if you select the Create repositories on first push in root compartment option and push an image with a command that includes the name of a repository that doesn't already exist, a new private repository is created automatically in the root compartment.

For example, if you enter a command like docker push iad.ocir.io/ansh81vru1zp/project02/acme-web-app:7.5.2 and the project02/acme-web-app repository doesn't exist, a private repository called project02/acme-web-app is created automatically in the root compartment.

Note that you must belong to the tenancy's Administrators group or have been granted the REPOSITORY_MANAGE permission on the tenancy to create the new private repository in the tenancy's root compartment. See Policies to Control Repository Access.