Image Repositories
Scenarios
An image repository manages container images. You can push and pull images to and from a repository and view the image build history.
Prerequisites
Before using an image repository, ensure that:
- You have purchased a repository.
- You have access to repositories. For details, see Overview.
- You have created an access credential.
Pushing an Image
- Prepare a computer that meets the following requirements:
- The container engine 1.11.2 or later is installed.
- The computer can be used within the network access range defined in Access Control.
- Log in to the computer as root.
- Use the access credential obtained in Access Credentials to log in to the registry and access a repository.
The message Login Succeeded will be displayed upon a successful login.
- Run the following command to tag the image:
docker tag[Image name 1:Tag 1] [Repository address]/[Namespace name]/[Image name 2:Tag 2]
In the preceding command:
- [Image name 1:Tag 1]: name and tag of the image to be pushed.
- [Repository address]: address for accessing the repository where the image is stored. To obtain the address, perform the following operations:
Log in to the SWR console. In the upper left corner, switch to your region. Click the repository name. On the Dashboard page, obtain the access address, as shown in Figure 1.
- [Namespace name]: namespace you created in Creating a Namespace.
- [Image name 2:Tag 2]: new name and tag for the image.
Example:
docker tag nginx:latest test-01-2v8iom.swr.cn-east-3.myhuaweicloud.com/library/nginx:1.1.1
- Push the image to a repository.
docker push [Repository address]/[Namespace name]/[Image name:Tag name]
Example:
docker push test-01-2v8iom.swr.cn-east-3.myhuaweicloud.com/library/nginx:1.1.1
The following information will be returned upon a successful push:
fbce26647e70: Pushed fb04ab8effa8: Pushed 8f736d52032f: Pushed 009f1d338b57: Pushed 678bbd796838: Pushed d1279c519351: Pushed f68ef921efae: Pushed v1: digest: sha256:0cdfc7910db531bfa7726de4c19ec556bc9190aad9bd3de93787e8bce3385f8d size: 1780
To view the image information, go to the repository details page and choose Images from the navigation pane.
After an image is pushed, you can use it to create a workload on the CCE console.
Obtaining an Image Pull Address
- Log in to the SWR console. In the upper left corner, switch to your region.
- Choose Images from the navigation pane.
- Click an image to go to its details page.
- Locate a desired image tag and obtain the image pull command in the Pull Command column.
Figure 2 Image pull command
Other Operations
- Searching for an image
Search for an image by namespace or name.
Figure 3 Searching for an image - Deleting an image
To delete an image, locate the image and click Delete. To avoid deleting important data by mistake, you need to enter DELETE to confirm the deletion.
Deleting an image will delete all its tags.
- Deleting an image tag
To delete an image tag, click the desired image name to go to its details page. Locate the target image tag, and click Delete. To avoid deleting important data by mistake, you need to enter DELETE to confirm the deletion.
Follow-up Operations
After images are pushed to a repository, you can:
- Configure an image signature policy so that images can be automatically signed. For details, see Signing an Image.
- Configure an image replication policy so that images can be replicated to another registry automatically. For details, see Image Replication.
- Configure an image retention policy to automatically delete unnecessary images. For details, see Image Retention.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot