Este conteúdo não está disponível no idioma selecionado.
Chapter 2. Getting started with Red Hat Quay
The Red Hat Quay registry can be deployed for non-production purposes on a single machine, either physical or virtual.
2.1. Prerequisites Copiar o linkLink copiado para a área de transferência!
Red Hat Enterprise Linux (RHEL) 8
- To obtain the latest version of Red Hat Enterprise Linux (RHEL) 8, see Downlad Red Hat Enterprise Linux.
- For installation instructions, see the Product Documentation for Red Hat Enterprise Linux 8.
- An active subscription to Red Hat
- Two or more virtual CPUs
- 4 GB or more of RAM
Approximately 30 GB of disk space on your test system, which can be broken down as follows:
- Approximately 10 GB of disk space for the Red Hat Enterprise Linux (RHEL) operating system.
- Approximately 10 GB of disk space for Docker storage for running three containers.
Approximately 10 GB of disk space for Red Hat Quay local storage.
NoteCEPH or other local storage might require more memory.
More information on sizing can be found at Quay 3.x Sizing Guidlines.
Red Hat Enterprise Linux (RHEL) 8 is recommended for highly available, production quality deployments of Red Hat Quay 3.8. RHEL 7 has not been tested with Red Hat Quay 3.8, and will be deprecated in a future release.
2.1.1. Using Podman Copiar o linkLink copiado para a área de transferência!
This document uses Podman for creating and deploying containers. For more information on Podman and related technologies, see Building, running, and managing Linux containers on Red Hat Enterprise Linux 8.
If you do not have Podman installed on your system, the use of equivalent Docker commands might be possible, however this is not recommended. Docker has not been tested with Red Hat Quay 3.8, and will be deprecated in a future release. Podman is recommended for highly available, production quality deployments of Red Hat Quay 3.8.
2.2. Preparing Red Hat Enterprise Linux for a Red Hat Quay proof of concept deployment Copiar o linkLink copiado para a área de transferência!
Use the following procedures to configure Red Hat Enterprise Linux (RHEL) for a Red Hat Quay proof of concept deployment.
2.2.1. Install and register the RHEL server Copiar o linkLink copiado para a área de transferência!
Use the following procedure to configure the Red Hat Enterprise Linux (RHEL) server for a Red Hat Quay proof of concept deployment.
Procedure
- Install the latest RHEL 8 server. You can do a minimal, shell-access only install, or Server plus GUI if you want a desktop.
- Register and subscribe your RHEL server system as described in How to register and subscribe a RHEL system to the Red Hat Customer Portal using Red Hat Subscription-Manager
Enter the following commands to register your system and list available subscriptions. Choose an available RHEL server subscription, attach to its pool ID, and upgrade to the latest software:
subscription-manager register --username=<user_name> --password=<password> subscription-manager refresh subscription-manager list --available subscription-manager attach --pool=<pool_id> yum update -y
# subscription-manager register --username=<user_name> --password=<password> # subscription-manager refresh # subscription-manager list --available # subscription-manager attach --pool=<pool_id> # yum update -y
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.2.2. Installing Podman Copiar o linkLink copiado para a área de transferência!
Use the following procedure to install Podman.
Procedure
Enter the following command to install Podman:
sudo yum install -y podman
$ sudo yum install -y podman
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Alternatively, you can install the
container-tools
module, which pulls in the full set of container software packages:sudo yum module install -y container-tools
$ sudo yum module install -y container-tools
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.2.3. Registry authentication Copiar o linkLink copiado para a área de transferência!
Use the following procedure to authenticate your registry for a Red Hat Quay proof of concept.
Procedure
Set up authentication to
registry.redhat.io
by following the Red Hat Container Registry Authentication procedure. Setting up authentication allows you to pull theQuay
container.NoteThis differs from earlier versions of Red Hat Quay, when the images were hosted on Quay.io.
Enter the following command to log in to the registry:
sudo podman login registry.redhat.io
$ sudo podman login registry.redhat.io
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You are prompted to enter your
username
andpassword
.
2.2.4. Firewall configuration Copiar o linkLink copiado para a área de transferência!
If you have a firewall running on your system, you might have to add rules that allow access to Red Hat Quay. Use the following procedure to configure your firewall for a proof of concept deployment.
Procedure
The commands required depend on the ports that you have mapped on your system, for example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.2.5. IP addressing and naming services Copiar o linkLink copiado para a área de transferência!
There are several ways to configure the component containers in Red Hat Quay so that they can communicate with each other, for example:
Using the IP addresses for the containers. You can determine the IP address for containers with
podman inspect
and then use the values in the configuration tool when specifying the connection strings, for example:sudo podman inspect -f "{{.NetworkSettings.IPAddress}}" postgresql-quay
$ sudo podman inspect -f "{{.NetworkSettings.IPAddress}}" postgresql-quay
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This approach is susceptible to host restarts, as the IP addresses for the containers will change after a reboot.
- Using a naming service. If you want your deployment to survive container restarts, which typically result in changed IP addresses, you can implement a naming service. For example, the dnsname plugin is used to allow containers to resolve each other by name.
-
Using the host network. You can use the
podman run
command with the--net=host
option and then use container ports on the host when specifying the addresses in the configuration. This option is susceptible to port conflicts when two containers want to use the same port. This method is not recommended. - Configuring port mapping. You can use port mappings to expose ports on the host and then use these ports in combination with the host IP address or host name.
This document uses port mapping and assumes a static IP address for your host system. Throughout the deployment, quay-sever.example.com
is used with the 192.168.1.112
IP address. This information is established in the /etc/hosts
file, for example:
cat /etc/hosts
$ cat /etc/hosts
Example output:
192.168.1.112 quay-server.example.com
192.168.1.112 quay-server.example.com
Component | Port mapping | Address |
---|---|---|
Quay |
| http://quay-server.example.com |
Postgres for Quay |
| quay-server.example.com:5432 |
Redis |
| quay-server.example.com:6379 |
Postgres for Clair V4 |
| quay-server.example.com:5433 |
Clair V4 |
| http://quay-server.example.com:8081 |
2.3. Configuring the database Copiar o linkLink copiado para a área de transferência!
Red Hat Quay requires a database for storing metadata. Postgres is used throughout this document and is recommended for highly available configurations. Alternatively, you can use MySQL with a similar approach to configuration as described below.
2.3.1. Setting up Postgres Copiar o linkLink copiado para a área de transferência!
For the Red Hat Quay proof of concept, a directory on the local file system to persist database data is used.
Procedure
In the installation folder, denoted here by the
$QUAY
variable, create a directory for the database data by entering the following command:mkdir -p $QUAY/postgres-quay
$ mkdir -p $QUAY/postgres-quay
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the appropriate permissions by entering the following command:
setfacl -m u:26:-wx $QUAY/postgres-quay
$ setfacl -m u:26:-wx $QUAY/postgres-quay
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start the
Postgres
container, specifying the username, password, and database name and port, with the volume definition for database data:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Ensure that the Postgres
pg_trgm
module is installed by running the following command:sudo podman exec -it postgresql-quay /bin/bash -c 'echo "CREATE EXTENSION IF NOT EXISTS pg_trgm" | psql -d quay -U postgres'
$ sudo podman exec -it postgresql-quay /bin/bash -c 'echo "CREATE EXTENSION IF NOT EXISTS pg_trgm" | psql -d quay -U postgres'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe
pg_trgm
module is required for theQuay
container.
2.4. Configuring Redis Copiar o linkLink copiado para a área de transferência!
Redis ia a key-value store that is used by Red Hat Quay for live builder logs and the Red Hat Quay tutorial.
2.4.1. Setting up Redis Copiar o linkLink copiado para a área de transferência!
Use the following procedure to deploy the Redis
container for the Red Hat Quay proof of concept.
Procedure
Start the
Redis
container, specifying the port and password, by entering the following command:sudo podman run -d --rm --name redis \ -p 6379:6379 \ -e REDIS_PASSWORD=strongpassword \ registry.redhat.io/rhel8/redis-6
$ sudo podman run -d --rm --name redis \ -p 6379:6379 \ -e REDIS_PASSWORD=strongpassword \ registry.redhat.io/rhel8/redis-6
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.5. Configuring Red Hat Quay Copiar o linkLink copiado para a área de transferência!
Use the following procedure to generate a configuration file that details all components, including registry settings, the database, and Redis connection parameters.
Procedure
To generate a configuration file, enter the following command to run the
Quay
container inconfig
mode. You must specify a password, for example, the stringsecret
:sudo podman run --rm -it --name quay_config -p 80:8080 -p 443:8443 registry.redhat.io/quay/quay-rhel8:v3.8.15 config secret
$ sudo podman run --rm -it --name quay_config -p 80:8080 -p 443:8443 registry.redhat.io/quay/quay-rhel8:v3.8.15 config secret
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use your browser to access the user interface for the configuration tool at
http://quay-server.example.com
.NoteThis documentation assumes that you have configured the
quay-server.example.com
hostname in your/etc/hosts
file.- Log in with username and password specified
Log in with the username and password you set in Step 1 of Configuring Red Hat Quay.
NoteIf you followed this procedure, the username is quayconfig and the password is secret.
2.5.1. Red Hat Quay setup Copiar o linkLink copiado para a área de transferência!
In the Red Hat Quay configuration editor, you must enter the following credentials:
- Basic configuration
- Server configuration
- Database
- Redis
2.5.1.1. Basic configuration Copiar o linkLink copiado para a área de transferência!
Under Basic Configuration, populate the Registry Title and Registry Title Short fields. The default values can be used if they are populated.
2.5.1.2. Server configuration Copiar o linkLink copiado para a área de transferência!
Under Server Hostname, specify the HTTP host and port for the location where the registry will be accessible on the network.
If you followed the instructions in this documenter, enter quay-server.example.com
.
2.5.1.3. Database Copiar o linkLink copiado para a área de transferência!
In the Database section, specify the connection details for the database that Red Hat Quay uses to store metadata.
If you followed the instructions in this document for deploying a proof of concept system, enter the following values:
- Database Type: Postgres
- Database Server: quay-server.example.com:5432
- Username: quayuser
- Password: quaypass
- Database Name: quay
2.5.1.4. Redis Copiar o linkLink copiado para a área de transferência!
The Redis key-value store is used to store real-time events and build logs.
If you followed the instructions in this document for deploying a proof-of-concept system, enter the following credentials under the Redis section:
- Redis Hostname: quay-server.example.com
- Redis port: 6379 (default)
- Redis password: strongpassword
2.5.2. Validate and download configuration Copiar o linkLink copiado para a área de transferência!
After all required fields have been set, validate your settings by clicking Validate Configuration Changes. If any errors are reported, continue editing your configuration until the settings are valid and Red Hat Quay can connect to your database and Redis servers.
After validation, download the Configuration file. Stop the Quay
container that is running the configuration editor.
2.6. Deploying Red Hat Quay Copiar o linkLink copiado para a área de transferência!
2.6.1. Prerequisites Copiar o linkLink copiado para a área de transferência!
- The Red Hat Quay database is running.
- The Redis server is running.
- You have generated a valid configuration file.
-
You have stopped the
Quay
container that was running the configuration editor.
2.6.2. Preparing the configuration folder Copiar o linkLink copiado para a área de transferência!
Use the following procedure to prepare your Red Hat Quay configuration folder.
Procedure
Create a directory to copy the Red Hat Quay configuration bundle to:
mkdir $QUAY/config
$ mkdir $QUAY/config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the generated Red Hat Quay configuration bundle to the directory:
cp ~/Downloads/quay-config.tar.gz ~/config
$ cp ~/Downloads/quay-config.tar.gz ~/config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Change into the the directory:
cd $QUAY/config
$ cd $QUAY/config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Unpack the Red Hat Quay configuration bundle:
tar xvf quay-config.tar.gz
$ tar xvf quay-config.tar.gz
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.6.3. Prepare local storage for image data Copiar o linkLink copiado para a área de transferência!
Use the following procedure to set your local file system to store registry images.
Procedure
Create a local directory that will store registry images by entering the following command:
mkdir $QUAY/storage
$ mkdir $QUAY/storage
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the directory to store registry images:
setfacl -m u:1001:-wx $QUAY/storage
$ setfacl -m u:1001:-wx $QUAY/storage
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.6.4. Deploy the Red Hat Quay registry Copiar o linkLink copiado para a área de transferência!
-
Use the following procedure to deploy the
Quay
registry container. Enter the following command to start the
Quay
registry container, specifying the appropriate volumes for configuration data and local storage for image data:sudo podman run -d --rm -p 80:8080 -p 443:8443 \ --name=quay \ -v $QUAY/config:/conf/stack:Z \ -v $QUAY/storage:/datastorage:Z \ registry.redhat.io/quay/quay-rhel8:v3.8.15
$ sudo podman run -d --rm -p 80:8080 -p 443:8443 \ --name=quay \ -v $QUAY/config:/conf/stack:Z \ -v $QUAY/storage:/datastorage:Z \ registry.redhat.io/quay/quay-rhel8:v3.8.15
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.7. Using Red Hat Quay Copiar o linkLink copiado para a área de transferência!
The following steps allow you to use the interface and create new organizations and repositories , and to search and browse existing repositories. Following step 3, you can use the command line interface to interact with the registry, and to push and pull images.
-
Use your browser to access the user interface for the Red Hat Quay registry at
http://quay-server.example.com
, assuming you have configuredquay-server.example.com
as your hostname in your/etc/hosts
file. -
Click
Create Account
and add a user, for example,quayadmin
with a passwordpassword
. From the command line, log in to the registry:
sudo podman login --tls-verify=false quay-server.example.com
$ sudo podman login --tls-verify=false quay-server.example.com Username: quayadmin Password: password Login Succeeded!
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.7.1. Push and pull images Copiar o linkLink copiado para a área de transferência!
To test pushing and pulling images from the Red Hat Quay registry, first pull a sample image from an external registry:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
podman images
command to see the local copy:sudo podman images
$ sudo podman images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/library/busybox latest 22667f53682a 14 hours ago 1.45 MB ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Tag this image, in preparation for pushing it to the Red Hat Quay registry:
sudo podman tag docker.io/library/busybox quay-server.example.com/quayadmin/busybox:test
$ sudo podman tag docker.io/library/busybox quay-server.example.com/quayadmin/busybox:test
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Next, push the image to the Red Hat Quay registry. Following this step, you can use your browser to see the tagged image in your repository.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To test access to the image from the command line, first delete the local copy of the image:
sudo podman rmi quay-server.example.com/quayadmin/busybox:test
$ sudo podman rmi quay-server.example.com/quayadmin/busybox:test Untagged: quay-server.example.com/quayadmin/busybox:test
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Pull the image again, this time from your Red Hat Quay registry:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow