Home Explore Blog CI



docker

2nd chunk of `content/manuals/harmonia/_index.md`
65746cf86befeb99b1508e4adddf44ae3940260853af0e680000000100000e65
    This maps the container's port `80` to the host's port `8080`. If port `8080` is already in use on your host, you can specify a different port.
2.  View the Nginx welcome page. Navigate to [`http://localhost:8080/`](http://localhost:8080/).
3.  Verify the running container:
    -   In the **Containers** tab in the Docker Desktop Dashboard, you should see your Nginx container listed.
    -   Alternatively, list all running containers in the cloud engine via the terminal:
        ```console
        $ docker ps
        ```
4.  Shut down the container:
    ```console
    $ docker kill cloudnginx
    ```

Running a container with a cloud engine is just as straightforward as running it locally.

### Step three: Create and switch to a new cloud engine

{{< tabs group="method" >}}
{{< tab name="Docker Desktop">}}

1. Create a new cloud engine:
   - Enter `cloudengine2` as the name
   - Choose an organization to associate the cloud engine with
   - Select the **Standard** engine size with the **AMD-64** architecture
   In the **Project Harmonia** view you should now see both `cloudengine` and `cloudengine2`. 
2. Switch between engines, also known as your Docker contexts. Use the context switcher in the top-left corner of the Docker Desktop Dashboard to toggle between your cloud engines or switch from your local engine (`desktop-linux`) to a cloud engine. 

{{< /tab >}}
{{< tab name="CLI">}}

1. Create a new cloud engine. Run:
   ```console
   $ docker harmonia engine create cloudengine2
   ```
   Docker automatically switches you to your new cloud engine. 
2. Switch between engines, also known as your Docker contexts. Either switch to your first cloud engine:
   ```console
   $ docker context use cloudengine
   ``` 
   Or switch back to your local engine: 
   ```console
   $ docker context use desktop-linux
   ```

{{< /tab >}}
{{< /tabs >}}

### Step four: Use a file sync for your cloud engine

Project Harmonia takes advantage of [Synchronized file shares](/manuals/desktop/features/synchronized-file-sharing.md) to enable local-to-remote file shares and port mappings. 

{{< tabs group="method" >}}
{{< tab name="Docker Desktop">}}

1. Clone the [Awesome Compose](https://github.com/docker/awesome-compose) repository.
2. In the Docker Desktop Dashboard, navigate to the **Project Harmonia** view.
3. For the `cloudengine` cloud engine, select the **Actions** menu and then **Manage file syncs**.
4. Select **Create file sync**.
5. Navigate to the `awesome-compose/react-express-mysql` folder and select **Open**.
6. In your terminal, navigate to the `awesome-compose/react-express-mysql` directory.
7. Run the project in the cloud engine with:
   ```console
   $ docker compose up -d
   ```
8. Test the application by visiting [`http://localhost:3000`](http://localhost:3000/).
   You should see the home page. The code for this page is located in `react-express-mysql/frontend/src/App.js`.
9. In an IDE or text editor, open the `App.js` file, change some text, and save. Watch as the code reloads live in your browser.

{{< /tab >}}
{{< tab name="CLI">}}

1. Clone the [Awesome Compose](https://github.com/docker/awesome-compose) repository.
2. In your terminal, change into the `awesome-compose/react-express-mysql` directory.
3. Create a file sync for `cloudengine`:
   ```console
   $ docker harmonia file-sync create --engine cloudengine $PWD
4. Run the project in the cloud engine with:
   ```console
   $ docker compose up -d
   ```
5. Test the application by visiting [`http://localhost:3000`](http://localhost:3000/).
   You should see the home page. The code for this page is located in `react-express-mysql/frontend/src/App.js`.

Title: Managing Cloud Engines and File Synchronization with Project Harmonia
Summary
This section explains how to manage cloud engines by creating new ones and switching between them via the Docker Desktop Dashboard and CLI. It further describes how to use file synchronization with a cloud engine, demonstrating how to set up a file sync, run a project in the cloud, and observe live code reloads, enhancing the development workflow.