Skip to content

Commit af2a5b3

Browse files
authored
Merge pull request #14 from ibm-cloud-architecture/bck-updateContainerImageRegistries
Bck update container image registries
2 parents 652c409 + 6744ec1 commit af2a5b3

File tree

1 file changed

+117
-5
lines changed

1 file changed

+117
-5
lines changed

docs/containers/imageregistry.md

Lines changed: 117 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,79 @@ A registry is a repository used to store and access container images. Container
44

55
Container registries save developers valuable time in the creation and delivery of cloud-native applications, acting as the intermediary for sharing container images between systems. They essentially act as a place for developers to store container images and share them out via a process of uploading (pushing) to the registry and downloading (pulling) into another system, like a Kubernetes cluster.
66

7-
[Learn More :fontawesome-solid-globe:](https://www.redhat.com/en/topics/cloud-native-apps/what-is-a-container-registry){ .md-button target="_blank"}
7+
Some examples of an image registry are **Red Hat Quay** and **IBM Cloud Registry**.
88

9-
=== "Tutorial"
9+
[Learn More :fontawesome-solid-globe:](https://www.redhat.com/en/topics/cloud-native-apps/what-is-a-container-registry){ .md-button target="\_blank"}
10+
11+
## Quay Tutorial
12+
13+
=== "Podman"
14+
15+
Make sure you have Podman Desktop installed and up and running.
16+
17+
Here's how to find a list of publicly available container images on DockerHub.
18+
19+
``` Bash title="Find Container Image"
20+
podman search docker.io/busybox
21+
```
22+
23+
``` Bash title="Output:"
24+
NAME DESCRIPTION
25+
docker.io/library/busybox Busybox base image.
26+
docker.io/rancher/busybox
27+
docker.io/openebs/busybox-client
28+
docker.io/antrea/busybox
29+
docker.io/hugegraph/busybox test image
30+
...
31+
```
32+
33+
We can create a _busybox_ container image based off of the _busybox_ base image you see listed in the output above.
34+
35+
``` Bash title="Create Image"
36+
podman run -it docker.io/library/busybox
37+
```
38+
39+
The _-it_ flag allows you to run the image in interactive mode. Interactive mode in Podman allows you to run a shell in a container and interact with it. However, you'll see that running small containers like this one don't have much to play around with in the interactive mode. To exit out of the interactive mode:
40+
41+
``` Bash title="Exit Interactive mode"
42+
exit
43+
```
44+
45+
You can also share images in a public registry so that others can use and review them. Here's how to push your image up to quay.io.
46+
47+
``` Bash title="Login to quay.io"
48+
podman login quay.io
49+
```
50+
Enter in the following info:
51+
52+
```
53+
Username: your_username
54+
Password: your_password
55+
```
56+
57+
Next, tag the image so that you can push it and find it in your account.
58+
59+
``` Bash title="Tag Image"
60+
podman tag <image_name> quay.io/your_username/image_registry_name
61+
```
62+
63+
Make sure to replace "image_name" with the name of the image you want to push up to quay.
64+
Replace "user_name" with your quay.io username.
65+
Replace "image_registry_name" with what you want the image to be named/labeled as in quay.
66+
67+
Once the image is tagged, you can push it up to quay.
68+
69+
``` Bash title="Push Image"
70+
podman push quay.io/your_username/image_registry_name
71+
```
72+
73+
Your respository has now been pushed to Quay Container Registry!
74+
75+
To view your repository, click on the button below:
76+
77+
[Repositories](https://quay.io/repository/){ .md-button target="_blank"}
78+
79+
=== "Docker"
1080

1181
Make sure you have Docker Desktop installed and up and running.
1282

@@ -17,7 +87,7 @@ Container registries save developers valuable time in the creation and delivery
1787
Email: your_email
1888
```
1989

20-
First we'll create a container with a single new file based off of the busybox base image:
90+
First we'll create a container with a single new file based off of the busybox base image:
2191
``` Bash title="Create a new container"
2292
docker run busybox echo "fun" > newfile
2393
```
@@ -40,7 +110,49 @@ Container registries save developers valuable time in the creation and delivery
40110
Your respository has now been pushed to Quay Container Registry!
41111

42112
To view your repository, click on the button below:
43-
113+
44114
[Repositories](https://quay.io/repository/){ .md-button target="_blank"}
45115

46-
116+
## IBM Cloud Registry Tutorial
117+
118+
=== "Podman"
119+
120+
=== "Docker"
121+
122+
Before you begin, you need to install the IBM Cloud CLI so that you can run the IBM Cloud ***ibmcloud*** commands.
123+
``` Bash title="Install the container-registry CLI"
124+
ibmcloud plugin install container-registry
125+
```
126+
127+
Then, you need to create a namespace. The namespace is created in the resource group that you specify so that you can configure access to resources within the namespace at the resource group level. If you don't specify a resource group, then the default is used.
128+
``` Bash title="Log in to IBM Cloud"
129+
ibmcloud login
130+
```
131+
132+
``` Bash title="Create namespace"
133+
ibmcloud cr namespace-add my_namespace
134+
```
135+
Make sure to replace "my_namespace" with your preferred namespace.
136+
137+
If you want to create the namespace in a specific resource group, use the following code **before** creating the namespace.
138+
``` Bash title="Specify a resource group"
139+
ibmcloud target -g resource_group
140+
```
141+
Replace "resource_group" with the resource group you want to create the namespace in.
142+
143+
``` Bash title="Validate namespace is created"
144+
ibmcloud cr namespace-list -v
145+
```
146+
147+
Next, you can pull images from IBM Cloud Registry to your local computer. Make sure [Docker](https://www.docker.com/products/container-runtime/#/download){target="_blank"} is installed and up and running.
148+
149+
``` Bash title="Pull image to local computer"
150+
docker pull source_image:tag
151+
```
152+
Replace "source_image" with ther respository of the image and "tag" with the tag of the image that you want to use. Below is an example.
153+
154+
```
155+
docker pull hello-world:latest
156+
```
157+
158+
[Learn More about Quay :fontawesome-brands-redhat:](https://docs.redhat.com/en/documentation/red_hat_quay/3.5/html/deploy_red_hat_quay_for_proof-of-concept_non-production_purposes/pr01){ .md-button target="\_blank"} [Learn More about ICR :fontawesome-solid-cloud:](https://cloud.ibm.com/docs/Registry?topic=Registry-getting-started&interface=ui){ .md-button target="\_blank"}

0 commit comments

Comments
 (0)