Creating a Repository
Find out how to create a repository in Container Registry.
After you create a standard 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.
When the top-level capability is disabled, a repository name can include slash characters (/). For example, project01/acme-web-app and project01/my-test-app are valid names for separate repositories.
When the top-level capability is enabled, the repository name must contain a single path segment and cannot include slash characters (/). For example, app is a valid repository name, but app/backend is not. After creating repository app, images can be stored at its root path or child paths, such as app:v1 and app/backend:v1. Both belong to repository app.
For more information and examples, see repository name.
When you create a repository, you choose the repository type:
Standard: Supports image pushes and pulls and stores images in the selected region.
-
Pull-through cache: A private repository that retrieves requested images from a configured upstream Container Registry registry in the same OCI realm and caches them in the selected region. Clients can pull images from the repository but cannot push images to it.
You can enable the top-level capability when creating either repository type. After the repository has been created, you cannot change its repository type or the top-level capability setting.
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>. If you select the Create repository on first push in root compartment option and push an image to a path that does not belong to an existing repository, a new private standard repository with the top-level capability disabled is created automatically in the tenancy's 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.
If the image path belongs to an existing standard repository with the top-level capability enabled, the push adds the image to that repository without creating a separate repository. For example, if standard repository app has the top-level capability enabled, pushing app/backend:v1 adds the image at child path backend in repository app. It does not create a repository named app/backend.
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.