Using Portainer to Deploy a MySQL Container (Historical Version)
Scenarios
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. FlexusL provides a Portainer application image running on Ubuntu 24.04 and deployed with Docker. The image comes pre-installed with Docker and Portainer. You can use this application image to visualize Docker management.
This practice applies to FlexusL instances with a Portainer application image purchased before August 28, 2026. For best practices of the new image version, see Using Portainer to Deploy a MySQL Container.
To update the image version, change the OS. This operation will clear the data on the original system disk. Back up the data in advance.
Prerequisites
You have purchased a FlexusL instance with a legacy Portainer application image.
Step 1: Configure Security Groups
Add inbound security group rules to ensure that the application preinstalled in the image can be accessed.
- Log in to the FlexusL console and click the target resource card or instance name to go to the instance details page.
- In the navigation pane on the left, choose Cloud Servers and click the target server name to view its details.

- On the Security Groups tab, click Add Rule to add the rules listed in the following table.
The following only lists 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 2: 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.
- 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.
Wait for several minutes until the 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 Access to the application dashboard
After the application is started, the initialization wizard page of the dashboard is displayed.

If the dashboard is not properly displayed, check the following causes:
- The port for accessing the dashboard is not enabled. Enable it as needed.
- The dashboard is being started. Try again later.
- Locate the resource card and choose
> Reset Password. Alternatively, in the list view, click Reset Password in the Operation column to reset the password for the FlexusL instance. 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 2 Resetting a password
- Locate the resource card and click Remote Login. Alternatively, in the list view, click Remote Login in the Operation column. In the displayed dialog box, click VNC Login and enter the username and password as prompted to log in to the FlexusL instance. For more login methods, see Login Modes.
The username is root, and the password is the one you set in the previous step.

Step 3: 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.
- In the Image area on the Overview page of the FlexusL console, click Access to go to the application dashboard. Figure 3 Access to the application dashboard
If the dashboard is not properly displayed, check the following causes:
- The port for accessing the dashboard is not enabled. Enable it as needed.
- 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.

- 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
- 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 4: 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.
- Choose Containers in the left navigation pane and click Add container.

- 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.
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.
- 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.
- ⑤ Restart policy: You are advised to select Always so that the container is always automatically restarted when it is stopped.

- Click Deploy the container to create a MySQL container.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot


