Easily Switch Between Product Types

You can click the drop-down list box to switch between different product types.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Preparing the Application Runtime

Updated on 2024-10-14 GMT+08:00

After application analysis, you have gained the understanding of the OS and runtime required for running the application. Make the following preparations:

  • Installing Docker: During application containerization, build a container image. To do so, you have to prepare a PC and install Docker on it.
  • Obtaining the base image tag: Determine the base image based on the OS on which the application runs. In this example, the application runs on CentOS 7.1 and the base image can be obtained from an open-source image repository.
  • Obtaining the runtime: Obtain the runtime of the application and the MongoDB database with which the application interconnects.

Installing Docker

Docker is compatible with almost all operating systems. Select a Docker version that best suits your needs.

NOTE:

SWR uses Docker 1.11.2 or later to upload images.

It is recommended that you install Docker and build images as the user root. Make sure to obtain the user root password for the host where Docker will be installed beforehand.

  1. Log in as user root to the device on which Docker is about to be installed.
  2. Quickly install Docker on the device running Linux. You can also manually install Docker. For details, see Docker Engine installation.

    curl -fsSL get.docker.com -o get-docker.sh

    sh get-docker.sh

  3. Run the following command to check the Docker version:

    docker version
    Client:
    Version: 17.12.0-ce
    API Version:1.35
    ...

    Version indicates the version number.

Obtaining the Base Image Tag

Determine the base image based on the OS on which the application runs. In this example, the application runs on CentOS 7.1 and the base image can be obtained from an open-source image repository.

NOTE:

Search for the image tag based on the OS on which the application runs.

  1. Visit the Docker website.
  2. Search for CentOS. The image corresponding to CentOS 7.1 is centos7.1.1503. Use this image name when editing the Dockerfile.

    Figure 1 Obtaining the CentOS version

Obtaining the Runtime

In this example, the web application of the Tomcat type is used. This application requires the runtime of Tomcat 7.0, and Tomcat requires JDK 1.8. In addition, the application must interconnect with the MongoDB database in advance.

NOTE:

Download the environment required by the application.

  1. Download Tomcat, JDK, and MongoDB installation packages of the specific versions.

    1. Download JDK 1.8.

      Download address: https://www.oracle.com/java/technologies/jdk8-downloads.html.

    2. Download Tomcat 7.0 from http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.82/bin/apache-tomcat-7.0.82.tar.gz.
    3. Download MongoDB 3.2 from https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.2.9.tgz.

  2. Log in as user root to the device running Docker.
  3. Run the following commands to create the directory where the application is to be stored: For example, set the directory to apptest.

    mkdir apptest

    cd apptest

  4. Use Xshell to save the downloaded dependency files to the apptest directory.
  5. Run the following commands to decompress the dependency files:

    tar -zxf apache-tomcat-7.0.82.tar.gz

    tar -zxf jdk-8u151-linux-x64.tar.gz

    tar -zxf mongodb-linux-x86_64-rhel70-3.2.9.tgz

  6. Save the enterprise application (for example, apptest.war) in the webapps/apptest directory of the Tomcat runtime environment.

    NOTE:

    apptest.war is used as an example only. Use your own application for actual configuration.

    mkdir -p apache-tomcat-7.0.82/webapps/apptest

    cp apptest.war apache-tomcat-7.0.82/webapps/apptest

    cd apache-tomcat-7.0.82/webapps/apptest

    ./../../../jdk1.8.0_151/bin/jar -xf apptest.war

    rm -rf apptest.war

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback