Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 4. Red Hat Quay repository overview
A repository provides a central location for storing a related set of container images. These images can be used to build applications along with their dependencies in a standardized format.
Repositories are organized by namespaces. Each namespace can have multiple repositories. For example, you might have a namespace for your personal projects, one for your company, or one for a specific team within your organization.
Red Hat Quay provides users with access controls for their repositories. Users can make a repository public, meaning that anyone can pull, or download, the images from it, or users can make it private, restricting access to authorized users or teams.
There are three ways to create a repository in Red Hat Quay: by pushing an image with the relevant podman
command, by using the Red Hat Quay UI, or by using the Red Hat Quay API. Similarly, repositories can be deleted by using the UI or the proper API endpoint.
4.1. Creating a repository by using the UI
Use the following procedure to create a repository using the Red Hat Quay UI.
Procedure
Use the following procedure to create a repository using the v2 UI.
Procedure
- Click Repositories on the navigation pane.
- Click Create Repository.
Select a namespace, for example, quayadmin, and then enter a Repository name, for example,
testrepo
.ImportantDo not use the following words in your repository name: *
build
*trigger
*tag
When these words are used for repository names, users are unable access the repository, and are unable to permanently delete the repository. Attempting to delete these repositories returns the following error:
Failed to delete repository <repository_name>, HTTP404 - Not Found.
Click Create.
Now, your example repository should populate under the Repositories page.
-
Optional. Click Settings
Repository visibility Make private to set the repository to private.
4.2. Creating a repository by using Podman
With the proper credentials, you can push an image to a repository using Podman that does not yet exist in your Red Hat Quay instance. Pushing an image refers to the process of uploading a container image from your local system or development environment to a container registry like Red Hat Quay. After pushing an image to your registry, a repository is created. If you push an image through the command-line interface (CLI) without first creating a repository on the UI, the created repository is set to Private.
Use the following procedure to create an image repository by pushing an image.
Prerequisites
-
You have download and installed the
podman
CLI. - You have logged into your registry.
- You have pulled an image, for example, busybox.
Procedure
Pull a sample page from an example registry. For example:
$ sudo podman pull busybox
Example output
Trying to pull docker.io/library/busybox... Getting image source signatures Copying blob 4c892f00285e done Copying config 22667f5368 done Writing manifest to image destination Storing signatures 22667f53682a2920948d19c7133ab1c9c3f745805c14125859d20cede07f11f9
Tag the image on your local system with the new repository and image name. For example:
$ sudo podman tag docker.io/library/busybox quay-server.example.com/quayadmin/busybox:test
Push the image to the registry. Following this step, you can use your browser to see the tagged image in your repository.
$ sudo podman push --tls-verify=false quay-server.example.com/quayadmin/busybox:test
Example output
Getting image source signatures Copying blob 6b245f040973 done Copying config 22667f5368 done Writing manifest to image destination Storing signatures
4.3. Creating a repository by using the API
Use the following procedure to create an image repository using the Red Hat Quay API.
Prerequisites
- You have Created an OAuth access token.
-
You have set
BROWSER_API_CALLS_XHR_ONLY: false
in yourconfig.yaml
file.
Procedure
Enter the following command to create a repository using the
POST /api/v1/repository
endpoint:$ curl -X POST \ -H "Authorization: Bearer <bearer_token>" \ -H "Content-Type: application/json" \ -d '{ "repository": "<new_repository_name>", "visibility": "<private>", "description": "<This is a description of the new repository>." }' \ "https://quay-server.example.com/api/v1/repository"
Example output
{"namespace": "quayadmin", "name": "<new_repository_name>", "kind": "image"}
4.4. Deleting a repository by using the UI
You can delete a repository directly on the UI.
Prerequisites
- You have created a repository.
Procedure
-
On the Repositories page of the v2 UI, check the box of the repository that you want to delete, for example,
quayadmin/busybox
. - Click the Actions drop-down menu.
- Click Delete.
Type confirm in the box, and then click Delete.
After deletion, you are returned to the Repositories page.
4.5. Deleting a repository by using the Red Hat Quay API
Use the following procedure to delete a repository using the Red Hat Quay API.
Prerequisites
- You have Created an OAuth access token.
-
You have set
BROWSER_API_CALLS_XHR_ONLY: false
in yourconfig.yaml
file.
Procedure
Enter the following command to delete a repository using the
DELETE /api/v1/repository/{repository}
endpoint:$ curl -X DELETE -H "Authorization: Bearer <bearer_token>" "<quay-server.example.com>/api/v1/repository/<namespace>/<repository_name>"
The CLI does not return information when deleting a repository from the CLI. To confirm deletion, you can check the Red Hat Quay UI, or you can enter the following
GET /api/v1/repository/{repository}
command to see if details are returned for the deleted repository:$ curl -X GET -H "Authorization: Bearer <bearer_token>" "<quay-server.example.com>/api/v1/repository/<namespace>/<repository_name>"
Example output
{"detail": "Not Found", "error_message": "Not Found", "error_type": "not_found", "title": "not_found", "type": "http://quay-server.example.com/api/v1/error/not_found", "status": 404}