Dear Fellows,
Do you know how to run Containers on ECS? and in how many ways? Don't worry! Today I am going to show how to run containers in different ways on the ECS (Elastic Cloud Server) of Huawei Cloud using Docker.
Procedure
After deploying ECS on Huawei cloud the procedure is given in the linkthen we installed Docker and if want to know how Docker is installed, please refer my previous article (https://forum.huawei.com/enterprise/en/topic-discussion-what-5g-products-have-you-used/thread/708073-887)
01 – Pulling from Public Images
First way to run an app in container is to download image from public location (docker repository) and run container on ECS with downloaded images (premade one).
# docker run –d –p <port:destination por> name:version
# docker run -d -p 8080:80 httpd:v1.1
This binds port 8080 of the container to TCP port 80
![]()
After running container, lets check it by
# docker container ls
Also web page can be viewed on browser by putting ip and desired port
Output
![]()
After use resources should be deleted. Container is deleted using
# docker rm <CONTAINER ID> -f -f for force if container is running
![]()
2 – Own Image downloading
Another way is to pull (download) image from your repository (or made by you), commands are same mostly.
1. Pull image
2. Run container with designated port so this app/web page should be separated
![]()
After running container, you may check it on console locally if it’s in working condition by
# curl 127.0.0.1:<port>
![]()
Output
Web page is visible at port 8500 on public IP
![]()
03 – Building Locally
You can create app or webpage locally, then build its image and then run it in container as well (image can be pushed to remote repository , later can be downloaded and run as well)
Let’s start building
# mkdir dockerfile // make seprate directory
# cd dockerfile // go into specific directory
# touch dockerfile1 // Create file
# vim dockerfile1 // open & edit file
![]()
# cat dockerfile1 // View file after creating
Now build image locally first
# docker build –t <image:version> -f <filename>
![]()
Run container using same command as described earlier
![]()
Ending Remark
This is step by step tutorial was to demonstrate containerization of application on Huawei cloud using ECS but Huawei also have services named as Cloud Container Instance (CCI) is a serverless container engine that allows you to run containers without creating and managing servers or clusters.
CCI allows you to directly create and use containerized workloads using the console, kubectl, or Kubernetes APIs, and pay only for the resources consumed by these workloads.



