Creating a Repository
Find out how to create a repository in Container Registry.
After you create a repository, you can push an image to it using the Docker CLI (see Pushing Images Using the Docker CLI). Any images that you subsequently push to the registry that include the same repository name are grouped into that repository.
Note that although a repository name can include slash characters, the slash does not represent a hierarchical directory structure. It is simply one character in a string of characters. As a convenience, you might choose to start the names of several different repositories with the same string, perhaps ending in a slash (such as project01/). Such a string is sometimes called a 'repository name prefix'. But a repository named project01/acme-web-app need not have any relationship with a repository named project01/my-test-app. Using the same repository name prefix for some repositories simply makes it easier to organize and control access to them in Container Registry, which can contain many other repositories. For more information and examples, see repository name.
Creating a repository before pushing an image is the usual workflow, but it's not always necessary. If you're not authorized to manage repositories in the tenancy's root compartment, you must always push an image to an existing repository. However, if you are authorized to push images to the tenancy's root compartment and you intend to do so, an existing repository is not necessary.
When you push an image, you normally use a command in the format docker push <registry-domain>/<tenancy-namespace>/<repo-name>:<version>. However, if you select the Create repository 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 the command docker push ocir.us-ashburn-1.oci.oraclecloud.com/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.
You must belong to the tenancy's Administrators group or have been granted the REPOSITORY_MANAGE permission on the tenancy to automatically create the private repository in the tenancy's root compartment. See Policies to Control Repository Access.
Use the oci artifacts container repository create command and required parameters to create a repository:
oci artifacts container repository create --display-name <repo-name> --compartment-id <compartment_ocid> [OPTIONS]For example:
oci artifacts container repository create --display-name project01/acme-web-app --compartment-id ocid1.compartment.oc1..aaaaaaaarvdfa72n...For a complete list of flags and variable options for CLI commands, see the Command Line Reference.
Run the CreateContainerRepository operation to create a repository.