Migrate from Docker Compose
Last updated
Was this helpful?
Last updated
Was this helpful?
This part explains how to migrate applications from Docker Compose to the Clawcloud Run platform.
Clawcloud Run offers features such as instant deployment, deep CI/CD integration, private networks, observability, and elastic scaling, allowing developers to focus on implementing business logic without worrying about the underlying infrastructure. Thanks to the user-friendly experience provided by the Clawcloud Run platform, developers can more easily migrate, deploy, and manage applications.
This part uses Wordpess with a MySQL database as an example to demonstrate how to migrate applications from Docker Compose to the Clawcloud Run platform.
What is Docker Compose?
Docker Compose is a tool for defining and running multi-container applications. It is the key to unlocking a streamlined and efficient development and deployment experience.
Compose simplifies the control of your entire application stack, making it easy to manage services, networks, and volumes in a single, comprehensible YAML configuration file. Then, with a single command, you create and start all the services from your configuration file.
The Docker Compose configuration file is as follows:
primarily involving the following parameters:
ports: publish a container's port(s) to the host;
environment: set environment variables;
volumes: bind mount a volume.
Next, we will demonstrate how to deploy an identical application on the Clawcloud Run platform using the same image, database and configuration parameters.
Log in to the Clawcloud Run console, navigate to the App Launchpad application, and click on "Create APP".
On the Application Deployment page, fill in the application parameters as specified in the table below:
Application Name
Wordpress with MySQL
Custom Application Name
Image Type
Public
Public or Private
Image Name
wordpress:latest
Format <User-name>/<Image-name>:tag
Usage Type
Fixed
Fixed or Scaling
Replicas
1
Set according to actual needs
CPU
2 Core
Set according to actual needs
Memory
4 G
Set according to actual needs
Next, configure the application parameters corresponding to the -p, -e, and -v options in the docker run command.
8080:80
Network - Container Port
80
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: exampleuser
WORDPRESS_DB_PASSWORD: examplepass
WORDPRESS_DB_NAME: exampledb
Advanced Configuration - Environment Variables
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: exampleuser
WORDPRESS_DB_PASSWORD: examplepass
WORDPRESS_DB_NAME: exampledb
wordpress:/var/www/html
Advanced Configuration - Local Storage
/var/www/html
Finally, click "Deploy Application" to deploy the application.
Next, create the MySQL database, navigate to the Database application, and click on "Create Database".
On the Database Deploy page, fill in the database parameters as specified in the table below:
Database Parameter
Parameter Value
Description
Type
MySQL
MySQL or PostgreSQL or Redis etc.
Version
mysql-8.0.30
Database version
Name
db
Custom Database Name
CPU
2 Core
Set according to actual needs
Memory
4 G
Set according to actual needs
Replicas
3
Set according to actual needs
Storage
100 G
Set according to actual needs
Backup
Off
Set according to actual needs
Finally, click "Deploy" to deploy the database.
Record the database connection details displayed in the console, such as Username, Password, Host, etc.
Go back to the App Launchpad, edit the Environment Variables for WordPress, input the database connection information, and restart the WordPress application.
You can now access Wordpress via the Public Address provided by the Clawcloud Run platform.
You can also use a custom domain to access the application. To set up a custom domain, please add a CNAME record for your domain pointing to the public address at your domain registrar. You can bind your custom domain once the DNS resolution takes effect.