docs/content/manuals/run-cloud/_index.md

9.0 KiB
Raw Blame History

title description keywords sitemap
Docker Run Cloud Learn how you can run your applications in the cloud with Docker Run Cloud run, cloud, docker desktop, resources false

{{% restricted title="Private preview" %}} Docker Run Cloud is in Private preview. {{% /restricted %}}

Docker Run Cloud brings the power of the cloud to your local development workflow. You can now run your applications in the cloud whilst continuing to use your existing tools and workflows and without worrying about local resource limitations. Docker Run Cloud also lets you share previews of your cloud-based applications for real-time feedback.

Set up

To get started with Docker Run Cloud, you need to:

  • Have a Docker account that's part of a Docker organization
  • Email run.cloud@docker.com to get help with onboarding

Quickstart

You can use Docker Run Cloud from the Docker Dashboard or from the CLI.

This guide introduces you to essential commands and steps for creating, managing, and sharing a cloud engine.

Step one: Create a cloud engine

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

  1. In the Docker Dashboard, navigate to the Docker Run Cloud tab.

  2. In the top right-hand corner, select Create Cloud Engine.

  3. Fill out the creation form:

    • Enter cloudengine as the name
    • Choose an organization to associate the cloud engine with
    • Select the engine size and architecture

    Note that the Switch Docker Context to use remote engine is selected by default. The automatically switches you to your new cloud engine once it has been created.

  4. Select Create.

To verify creation, check the context switcher in the top-left corner of the Docker Dashboard; it should display cloudengine. Youre now ready to use it.

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

Run the following command:

$ docker harmonia engine create cloudengine --arch "amd64"  --use

This creates an engine called cloudengine and:

  • Immediately switches you to the new cloud engine with the --use flag.
  • Sets the engine's CPU architecture to amd64 using the --arch "amd64" flag. You can choose between amd64 and arm64.
  • Configures the engine size with the --size "standard" flag. Options are standard (2 CPU cores, 4GB RAM, default) or large (4 CPU cores, 8GB RAM).

To verify you're using the newly created cloud engine, run:

$ docker context inspect

You should see the following:

[
    {
        "Name": "cloudengine2",
...

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

Step two: Run and remove containers with the newly created cloud engine

  1. Run an Nginx container in the cloud engine:
    $ docker run -d -p 8080:80 nginx
    
    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/.
  3. Verify the running container:
    • In the Containers tab in the Docker Dashboard, you should see your Nginx container listed.
    • Alternatively, list all running containers in the cloud engine via the terminal:
      $ docker ps
      

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 Docker Run Cloud 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 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:
    $ 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:
    $ 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

Docker Run Cloud takes advantage of Synchronized file shares to enable local-to-remote file shares and port mappings.

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

  1. Clone the Awesome Compose repository.
  2. In the Docker Dashboard, navigate to the Docker Run Cloud 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:
    $ docker compose up -d
    
  8. Test the application by visiting 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 repository.
  2. In your terminal, change into the awesome-compose/react-express-mysql directory.
  3. Create a file sync for cloudengine:
    $ docker harmonia file-sync create --engine cloudengine $PWD
    
  4. Run the project in the cloud engine with:
    $ docker compose up -d
    
  5. Test the application by visiting http://localhost:3000.
    You should see the home page. The code for this page is located in react-express-mysql/frontend/src/App.js.
  6. 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 >}} {{< /tabs >}}

Step five: Share a container port

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

  1. Make sure your Docker context is set to cloudengine.
  2. In your terminal, run the Nginx container:
    $ docker run -d -p 8080:80 nginx
    
  3. In the Docker Dashboard, navigate to the Containers view.
  4. Select the lock icon in the Ports column of your running container. This creates a publicly accessible URL that you can share with teammates.
  5. Select the copy icon, to copy this URL.

To view all shared ports for your Docker context, select the Shared ports icon in the bottom-right corner of the Docker Dashboard.

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

To share a container port, make sure your Docker context is set to cloudengine and then run:

$ docker harmonia engine share create cloudengine 3000

This returns a publicly accessible URL for your React app hosted on port 3000, that you can share with teammates.

To see a list of all your shared ports, run:

$ docker harmonia engine share list 

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

Step six: Clean up

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

To remove a file sync session:

  1. Navigate to your cloud engine in the Docker Run Cloud view.
  2. Select the Actions menu and then Manage file syncs.
  3. Select the drop-down icon on the file sync.
  4. Select Delete.

To remove a cloud engine, navigate to the Docker Run Cloud view and then select the delete icon.

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

To remove the file sync session, run:

$ docker harmonia file-sync delete --engine cloudengine $PWD

To remove a cloud engine, run:

$ docker harmonia engine delete <name-of-engine>

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

Troubleshoot

Run docker harmonia doctor to print helpful troubleshooting information.

Known issues

  • KinD does not run on Docker Run Cloud due to some hard-coded assumptions to ensure it's running in a privileged container. K3d is a good alternative.
  • Containers cannot access host through DNS host.docker.internal.
  • File binds (non-directory binds) are currently static, meaning changes will not be reflected until the container is restarted. This also affects Compose configs and secrets directives.
  • Bind volumes are not supported.
  • Port-forwarding support for UDP
  • Docker Compose projects relying on watch in sync mode are not working with the tar synchronizer. Configure it to use docker cp instead, disable tar sync by setting COMPOSE_EXPERIMENTAL_WATCH_TAR=0 in your environment.
  • Some Docker Engine features that let you access the underlying host, such as --pid=host, --network=host, and --ipc=host, are currently disabled.