El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.

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

Using Portainer to Deploy a MySQL Container

Updated on 2025-02-14 GMT+08:00

Application Scenario

Portainer is a graphical tool for Docker management. It offers a range of functions such as status display, quick deployment of application templates, basic operations on Docker (containers, images, networks, and database logical volumes), log display, container console operations, centralized management and operations of Swarm clusters and services, and user login management and control. Supported By FlexusL, the Portainer application image uses Ubuntu 22.04 and is deployed using Docker. The Docker and Portainer have been preconfigured in the image. You can use this application image to visualize Docker management.

Resource Planning and Costs

Resource

Configuration

Description

Cloud server

  • vCPUs: 2
  • Memory: 4 GiB

Select appropriate instance specifications based on your service requirements.

Image

Portainer

Select the Portainer application image.

Security group

Inbound rule:

  • Protocol/Application: TCP
  • Port: 80,9001,3306
  • Source: 0.0.0.0/0
  • 3306: Allows access to MySQL databases.
  • 80: Specifies the internal forwarding port of application images.
  • 9000: Allows external access to the application O&M page.
  • 9001: Allows external access to the application dashboard.

Process

Procedure

Description

Step 1: Purchase a FlexusL Instance

Purchase a FlexusL instance and select the Portainer application image.

Step 2: Configure Security Groups

Add inbound security group rules to ensure that the application preinstalled in the image can be accessed.

Step 3: Reset the Password and Log In to the FlexusL Instance

A FlexusL instance does not have an initial password. After creating a FlexusL instance, set a password for the FlexusL instance before logging in to it.

Step 4: Initialize Portainer

Log in to the dashboard and install and initialize Portainer.

Step 5: Use Portainer to Deploy a MySQL Container

Use Portainer to visualize Docker management (using MySQL container as an example)

Step 1: Purchase a FlexusL Instance

  1. Log in to the FlexusLconsole and click Buy FlexusL.
  2. Specify required parameters for the FlexusL instance.

    Parameter

    Example

    Description

    Region

    CN-Hong Kong

    For low network latency and quick resource access, select the region nearest to your target users. After a FlexusL instance is created, the region cannot be changed. Exercise caution when selecting a region.

    Application Image

    Portainer

    Select the Portainer application image.

    Instance Specifications

    2 vCPUs | 4 GiB memory and 80 GiB system disk

    Select instance specifications as needed.

    Instance Name

    Portainer-Example

    Customize an instance name that is easy to identify, for example, Portainer-Example.

    (Optional) Associated Services

    • Data disk: 10 GiB
    • Host security
    • Cloud backup vault: 90 GiB

    You can bundle any of EVS, HSS (basic edition), and CBR to your FlexusL instances as needed and set specifications as needed.

    Required Duration

    1 month

    The minimum duration of a purchase is one month and the maximum duration is three years.

    Auto-renew is enabled by default, which means the purchased FlexusL instances will be automatically renewed before they expire. If you do not enable auto-renew during the purchase process, you can still enable it later after the instances are created. For more information about auto-renewal rules, see Auto-Renewal Rules.

    Quantity

    1

    Set the number of FlexusL instances to be purchased.

  3. Click Buy Now and complete the payment as prompted.
  4. Go back to the FlexusL console and view the purchased FlexusL instance.

Step 2: Configure Security Groups

Add inbound security group rules to ensure that the application preinstalled in the image can be accessed.

  1. Log in to the FlexusL console and click a resource card to go to the instance details page.
  2. In the navigation pane on the left, choose Cloud Servers. Locate the server and click its name.

  3. On the Security Groups tab, click Add Rule. In the displayed dialog box, add rules displayed in the following figure and click OK.

    The following figure only displays common rules. You can add more rules as needed.

    Table 1 Security group rules

    Priority

    Action

    Type

    Protocol & Port

    Source

    Description

    1

    Allow

    IPv4

    TCP: 80

    0.0.0.0/0

    Specifies the internal forwarding port of application images

    1

    Allow

    IPv4

    TCP: 3306

    0.0.0.0/0

    Allows access to MySQL databases.

    1

    Allow

    IPv4

    TCP: 9001

    0.0.0.0/0

    Allows external access to the application dashboard.

Step 3: Reset the Password and Log In to the FlexusL Instance

This section describes how to log in to a FlexusL instance. A FlexusL instance does not have an initial password. After creating a FlexusL instance, set a password for the FlexusL instance before logging in to it.

  1. In the Image area on the Overview page of the FlexusL console, click Access to go to the application dashboard and check whether the application has been up and running. If yes, go to the next step.
    NOTICE:

    Wait for several minutes until the image with the pre-installed application is up and running. Then, you can perform operations such as restarting or stopping the instance, or resetting the password. Otherwise, the initial password may become invalid and you cannot log in to the application dashboard.

    Figure 1 Entry to the application dashboard

    After the application is started, the initialization wizard page of the dashboard is displayed, as shown in Figure 2.

    Figure 2 Initialization wizard page of the Portainer dashboard
    NOTE:

    If the dashboard is not properly displayed, check the following causes:

    • The port for accessing the dashboard is not allowed. Check whether the port is allowed based on Step 2: Configure Security Groups.
    • The dashboard is being started. Try again later.
  2. Locate the resource card and choose > Reset Password to reset the password.

    A FlexusL instance does not have an initial password. Set a password for the FlexusL instance before logging in to it. For details, see Resetting the Password for a FlexusL Instance.

    Figure 3 Resetting a password
  3. Locate the target instance and click Remote Login and enter the username and password as prompted to log in to the FlexusL instance.

    The username is root, and the password is the one set in 2.

Step 4: Initialize Portainer

Application images use code-based Ubuntu. They provide graphical user interfaces to make your operations easier. You need to initialize the application dashboard upon the first login. Then you can directly log in to the dashboard from the FlexusL console afterwards.

  1. On the Overview page, click Access in the Dashboard field in the Image area.

    NOTE:

    If the dashboard is not properly displayed, check the following causes:

    • The port for accessing the dashboard is not allowed. Check whether the port is allowed based on Step 2: Configure Security Groups.
    • The dashboard is being started. Try again later.

    If you use a Portainer application image to create, reinstall, or change the OS of a FlexusL instance, Portainer initialization has a certain validity period. If no users are created within the validity period, a message in the following figure is displayed. In this case, log in to the server and run sudo docker restart portainer to restart Portainer, and then create a user as soon as possible.

  2. Set the username and password of the Portainer administrator and click Create user.

    If you have backup data for Portainer, click Restore Portainer from backup and upload the backup data to quickly set up the Portainer environment.

    Figure 4 Initialization wizard page of the Portainer dashboard
  3. Choose Home and click local to use Portainer for Docker visual management.

After the Portainer application is initialized, you can deploy your containers on the dashboard.

Step 5: Use Portainer to Deploy a MySQL Container

This section uses the MySQL container as an example to describe how to use Portainer to visualize Docker management.

  1. Choose Containers in the left navigation pane and click Add container.

  2. Specify MySQL container parameters.
    • Name: user-defined container name.
    • Image: container image name. For example, if you set this parameter to mysql:5.7, the system automatically pulls the MySQL5.7 container image from Docker Hub.
    • ③ Click publish a new network port and add port 3306 to ensure that the MySQL database can be accessed.
    • Env: environment variables.
      • MYSQL_ROOT_PASSWORD: password of the root user of the database. This parameter is mandatory. It is used for logging in to the MySQL container. Keep the password secure.
        NOTE:

        Ensure that the MYSQL_ROOT_PASSWORD parameter name is correctly entered, or the database cannot be connected.

      • MYSQL_DATABASE: name (such as wordpress) of the database which is automatically created in the value row after the MySQL container is created. This parameter is optional.
    • Restart policy: You are advised to select Always so that the container is always automatically restarted when it is stopped.

  3. Click Deploy the container to create a MySQL container.
  1. Return to the container list and click in the MySQL container row.

  2. On the displayed page, click Connect to connect to the container.
  3. Run the following command to log in to the MySQL database:

    mysql -uroot –p123456, in which 123456 is the value of MYSQL_ROOT_PASSWORD.

  1. Choose Containers in the left navigation pane and click Add container.

  2. Specify MySQL container parameters.
    • Name: user-defined container name.
    • Image: container image name. For example, if you set this parameter to mysql:5.7, the system automatically pulls the MySQL5.7 container image from Docker Hub.
    • ③ Click publish a new network port and add port 3306 to ensure that the MySQL database can be accessed.
    • Env: environment variables.
      • MYSQL_ROOT_PASSWORD: password of the root user of the database. This parameter is mandatory. It is used for logging in to the MySQL container. Keep the password secure.
        NOTE:

        Ensure that the MYSQL_ROOT_PASSWORD parameter name is correctly entered, or the database cannot be connected.

      • MYSQL_DATABASE: name (such as wordpress) of the database which is automatically created in the value row after the MySQL container is created. This parameter is optional.
    • Restart policy: You are advised to select Always so that the container is always automatically restarted when it is stopped.

  3. Click Deploy the container to create a MySQL container.
  1. Return to the container list and click in the MySQL container row.

  2. On the displayed page, click Connect to connect to the container.
  3. Run the following command to log in to the MySQL database:

    mysql -uroot –p123456, in which 123456 is the value of MYSQL_ROOT_PASSWORD.

Utilizamos cookies para mejorar nuestro sitio y tu experiencia. Al continuar navegando en nuestro sitio, tú aceptas nuestra política de cookies. Descubre más

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback