Updated on 2024-12-04 GMT+08:00

Analyzing the Application

Before containerizing an application, analyze the running environment and dependencies of the application, and get familiar with the application deployment mode. For details, see Table 1.

Table 1 Application environment

Category

Sub-category

Description

Runtime environment

OS

OS that the application runs on, such as CentOS or Ubuntu.

In this example, the application runs on CentOS 7.1.

Runtime environment

The Java application requires Java Development Kit (JDK), the Go language requires GoLang, the web application requires Tomcat environment, and the corresponding version number needs to be confirmed.

In this example, the web application of the Tomcat type is used. This application requires the runtime environment of Tomcat 7.0, and Tomcat requires JDK 1.8.

Dependency package

Understand required dependency packages, such as OpenSSL and other system software, and their version numbers.

In this example, no dependency package is required.

Deployment mode

Peripheral configurations

MongoDB database: In this example, the MongoDB database and Tomcat application are deployed on the same server. Therefore, their configurations can be fixed and there is no need to extract their configurations.

External services with which the application needs to interconnect, such as databases and file systems.

These configurations need to be manually configured each time you deploy an application on a VM. However, through containerized deployment, environment variables can be injected into a container, facilitating deployment.

In this example, the application needs to interconnect with the MySQL database. Obtain the database configuration file. The server address, database name, database login username, and database login password are injected through environment variables.

url=jdbc:mysql://Server address/Database name        #Database connection URL
username=****                         #Username for logging in to the database
password=****                         #Password for logging in to the database

Application configurations

Sort out the configuration parameters, such as configurations that need to be modified frequently and those remain unchanged during the running of the application.

In this example, no application configurations need to be extracted.

NOTE:

To avoid frequent image replacement, you are advised to classify configurations of the application.

  • For the configurations (such as peripheral interconnection information and log levels) that are frequently changed, you are advised to configure them as environment variables.
  • For the configurations that remain unchanged, directly write them into images.