# Migrate from Docker Compose

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.

<figure><img src="/files/jsib4DpIIMSsX8mJjZ4q" alt=""><figcaption><p>Worpress</p></figcaption></figure>

#### Background Information

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:

{% code title="docker-compose.yml" overflow="wrap" lineNumbers="true" %}

```yaml
services:

  wordpress:
    image: wordpress
    restart: always
    ports:
      - 8080:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: exampleuser
      WORDPRESS_DB_PASSWORD: examplepass
      WORDPRESS_DB_NAME: exampledb
    volumes:
      - wordpress:/var/www/html

  db:
    image: mysql:8.0
    restart: always
    environment:
      MYSQL_DATABASE: exampledb
      MYSQL_USER: exampleuser
      MYSQL_PASSWORD: examplepass
      MYSQL_RANDOM_ROOT_PASSWORD: '1'
    volumes:
      - db:/var/lib/mysql

volumes:
  wordpress:
  db:
```

{% endcode %}

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.

#### **Deployment Steps**

Log in to the Clawcloud Run console, navigate to the App Launchpad application, and click on "Create APP".

<figure><img src="/files/bNGE6eGzFEHY1D6MX0x9" alt=""><figcaption><p>Clawcloud Run Console</p></figcaption></figure>

<figure><img src="/files/bafQhhhgnmvblKNGmYAA" alt=""><figcaption><p>App Launchpad</p></figcaption></figure>

On the Application Deployment page, fill in the application parameters as specified in the table below:

| Application Parameter | Parameter Value      | Description                           |
| --------------------- | -------------------- | ------------------------------------- |
| 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.&#x20;

| Docker Parameters                                                                                                                                                                                         | Application Parameter                          | Parameter Value                                                                                                                                       |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `8080:80`                                                                                                                                                                                                 | Network - Container Port                       | 80                                                                                                                                                    |
| <p><code>WORDPRESS\_DB\_HOST: db</code></p><p><code>WORDPRESS\_DB\_USER: exampleuser</code></p><p><code>WORDPRESS\_DB\_PASSWORD: examplepass</code></p><p><code>WORDPRESS\_DB\_NAME: exampledb</code></p> | Advanced Configuration - Environment Variables | <p>WORDPRESS\_DB\_HOST: db</p><p>WORDPRESS\_DB\_USER: exampleuser</p><p>WORDPRESS\_DB\_PASSWORD: examplepass</p><p>WORDPRESS\_DB\_NAME: exampledb</p> |
| `wordpress:/var/www/html`                                                                                                                                                                                 | Advanced Configuration - Local Storage         | `/var/www/html`                                                                                                                                       |

Finally, click "Deploy Application" to deploy the application.

<figure><img src="/files/P1eBV0laPGa2M2y2wE5a" alt=""><figcaption><p>Deploy Application</p></figcaption></figure>

Next, create the MySQL database, navigate to the Database application, and click on "Create Database".

<figure><img src="/files/9psOHHIRIzvckNCbvylg" alt=""><figcaption><p>Clawcloud Run Database</p></figcaption></figure>

<figure><img src="/files/AOgya4ogQoKVoFMmidUJ" alt=""><figcaption><p>Create Database</p></figcaption></figure>

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.

<figure><img src="/files/BCs6AIrTBf0lxvpZOYrW" alt=""><figcaption><p>Deploy Database</p></figcaption></figure>

Record the database connection details displayed in the console, such as Username, Password, Host, etc.

<figure><img src="/files/vkzhYBNZmXDFVRBm5jXm" alt=""><figcaption><p>Database Connection Details</p></figcaption></figure>

Go back to the App Launchpad, edit the Environment Variables for WordPress, input the database connection information, and restart the WordPress application.

<figure><img src="/files/VBKk9BQY0R4XPQfbg1mc" alt=""><figcaption><p>Edit Environment Variables</p></figcaption></figure>

You can now access Wordpress via the Public Address provided by the Clawcloud Run platform.

<figure><img src="/files/HjYOMIAaNJRy4Us1Nx2X" alt=""><figcaption><p>Wordpress Initialization interface</p></figcaption></figure>

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.

<figure><img src="/files/EgOre5LYQHjEHyw7Vlnu" alt=""><figcaption><p>Custom Domain</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.run.claw.cloud/clawcloud-run/migration/migrate-from-docker-compose.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
