☁️How to Upload an Image to Image Registry (Huawei SWR)

Rabia Yılmaz
Huawei Developers
Published in
6 min readJul 5, 2023
Huawei Cloud SWR

Introduction

🎉 Welcome to the world of 📷 image registries! 🚀

Whether you’re a developer, a DevOps engineer, or just someone interested in tech, you’ve probably heard of image registries. But what are they exactly? 🤔

Simply put, an image registry is a place where you can store and manage your 🖼️ container images. Container images are like snapshots of your application and all its dependencies, bundled together into a single package.

Huawei’s software repo (SWR) is one such image registry that offers a wide range of features to help you manage your container images with ease. With SWR, you can securely store your container images in the cloud, easily share them with others, and automate your build and deployment workflows. Plus, SWR supports public and private repositories, so you can choose who can access your images. 🔒

Some other key features of SWR include support for multiple image formats, including Docker and Open Container Initiative (OCI), as well as integration with popular CI/CD tools like Jenkins and GitLab. And with Huawei’s strong focus on security, you can be sure that your images are safe and protected at all times. 🔐

So there you have it — a quick introduction to Huawei’s SWR image registry. Whether working on a small personal project or a large-scale enterprise app, SWR can help simplify your container image management and streamline your development workflows. Happy containerizing! 🐳

What are Image Registry and Huawei SWR?

An image registry is a centralized storage location where container images are stored and managed. It allows developers to share, store, and manage container images with ease. An image registry also enables users to control access to images, monitor their usage, and ensure the integrity of images.

Huawei SWR (Software Repository for Container) is Huawei’s cloud-based image repository service that supports Docker and Kubernetes. It provides a secure and reliable platform for storing, managing, and deploying container images at scale. With SWR, users can easily build, publish, and deploy container images across different environments. Additionally, it supports integration with other Huawei cloud services, such as Elastic Cloud Server (ECS) and Kubernetes Service (KS).

Huawei Cloud SWR

Why do we need an Image Registry?

Image registries are needed to store and manage container images. Containerization has become an increasingly popular way of deploying software applications, and image registries provide a central location for hosting container images that can be used to deploy containers in different environments.

By using an image registry, you can store and manage a large number of container images, making it easier to manage your application’s deployment process. Image registries also allow you to version your container images, so you can track changes and roll back to previous versions if necessary.

In addition, image registries provide security features such as access control and image signing, which help ensure that only authorized users can access your container images and that the images have not been tampered with.

Overall, image registries are an essential component of modern container-based application deployment, as they provide a secure and scalable solution for managing container images.

Advantages of Huawei SWR

  1. Scalability: Huawei SWR is a cloud-based image repository service that can scale up or down according to your needs. This makes it suitable for organizations of all sizes, from small startups to large enterprises.
  2. Security: Huawei SWR provides multiple layers of security, including encryption, access control, and network isolation. This ensures that your container images are protected against unauthorized access, tampering, and malware.
  3. High Availability: Huawei SWR supports multi-zone redundancy, which means that your container images are replicated across different data centers. This ensures that your images are always available and accessible, even in the event of a disaster.
  4. Integration with Other Services: Huawei SWR integrates seamlessly with other Huawei cloud services, such as Elastic Cloud Server (ECS) and Kubernetes Service (KS). This allows you to deploy your container images quickly and easily across different environments.
  5. Cost-Effective: Huawei SWR offers a pay-as-you-go pricing model, meaning you only pay for what you use. This makes it a cost-effective solution for managing your container images, especially if you have variable workloads.

How to Push an Image to SWR?

Huawei cloud image registry flow

Install Docker

The docker installation script is below for Ubuntu.

Build an image With Dockerfile

Copy the below code and paste it on the Dockerfile.

Build the docker file with the below code.

docker build -t tetris .
Dockerfile
build dockerfile
docker build -t <image-name> .
Docker image list
docker image ls

NOTE: This docker image is just for example. If you have any other docker images you can follow the next steps to push your image to SWR.

Create an Organization

Huawei SWR
Create an organization

Connect to Huawei SWR

  1. Log in to the SWR console.
  2. In the navigation pane on the left, choose Dashboard and click Generate Login Command in the upper right corner. On the displayed page, copy the login command.
SWR login command

Upload the image

Edit the code like this:

# Push the image to SWR
sudo docker push swr.ap-southeast-1.myhuaweicloud.com/rabiatest/tetris


# Test for pull image
sudo docker pull swr.ap-southeast-1.myhuaweicloud.com/rabiatest/tetris
image tagging
/home/rabia/tetris# docker tag tetris swr.ap-southeast-1.myhuaweicloud.com/rabiatest/tetris
/home/rabia/tetris# docker image ls
example image registry images

Conclusion

✨ In conclusion, the Software Repository for Container demo provides a comprehensive overview of creating and publishing a container image to a registry using Docker. By following the step-by-step instructions in the article, readers can gain hands-on experience with the Docker CLI and Dockerfile syntax while also learning about the importance of image registries and best practices for publishing container images.

The article covers theoretical concepts such as containerization, image registries, and best practices for building container images, as well as practical examples that readers can follow along with to gain real-world experience. 🙌

References

--

--