Home Explore Blog Models CI



docker

3rd chunk of `content/manuals/extensions/extensions-sdk/architecture/_index.md`
01bb3865504b16b8173d33636c76a92d4a55644aeb927ed70000000100000ca4
In some cases, a `compose.yaml` file can be used instead of an `image`. This is useful when the backend container
needs more specific options, such as mounting volumes or requesting [capabilities](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities)
that can't be expressed just with a Docker image. The `compose.yaml` file can also be used to add multiple containers
needed by the extension, like a database or a message broker. 
Note that, if the Compose file defines many services, the SDK can only contact the first of them.

> [!NOTE]
>
> In some cases, it is useful to also interact with the Docker engine from the backend.
> See [How to use the Docker socket](../guides/use-docker-socket-from-backend.md) from the backend.

To communicate with the backend, the Extension SDK provides [functions](../dev/api/backend.md#get) to make `GET`,
`POST`, `PUT`, `HEAD`, and `DELETE` requests from the frontend. Under the hood, the communication is done through a socket
or named pipe, depending on the operating system. If the backend was listening to a port, it would be difficult to
prevent collision with other applications running on the host or in a container already. Also, some users are
running Docker Desktop in constrained environments where they can't open ports on their machines.

![Backend and frontend communication](/Users/baehyunsol/Documents/Rust/ragit/sample/docker/content/manuals/extensions/extensions-sdk/architecture/images/extensions-arch-2.png?w=500h=300)

Finally, the backend can be built with any technology, as long as it can run in a container and listen on a socket.

Learn more about [adding a backend](/manuals/extensions/extensions-sdk/build/backend-extension-tutorial.md) to your extension.

## Executables

In addition to the frontend and the backend, extensions can also contain executables. Executables are binaries or shell scripts
that are installed on the host when the extension is installed. The frontend can invoke them with [the extension SDK](../dev/api/backend.md#invoke-an-extension-binary-on-the-host).

These executables are useful when the extension needs to interact with a third-party CLI tool, like AWS, `kubectl`, etc.
Shipping those executables with the extension ensure that the CLI tool is always available, at the right version, on
the users' machine.

When Docker Desktop installs the extension, it copies the executables on the host as defined by the `host` section in
the `metadata.json`. See the [ui metadata section](metadata.md#host-section) for more details.

![Executable and frontend communication](/Users/baehyunsol/Documents/Rust/ragit/sample/docker/content/manuals/extensions/extensions-sdk/architecture/images/extensions-arch-3.png?w=250h=300)

However, since they're executed on the users' machine, they have to be available to the platform they're running on.
For example, if you want to ship the `kubectl` executable, you need to provide a different version for Windows, Mac,
and Linux. Multi arch images will also need to include binaries built for the right arch (AMD / ARM)


See the [host metadata section](metadata.md#host-section) for more details.

Learn how to [invoke host binaries](../guides/invoke-host-binaries.md).

Title: Backend Communication, Executables, and Host Interaction
Summary
A `compose.yaml` file provides more flexibility for backend container configuration. The Extension SDK facilitates frontend-backend communication via HTTP requests over sockets or named pipes. Backends can be built with any technology as long as they can run in a container and listen on a socket. In addition to frontend and backend, extensions can include executables, which are binaries or shell scripts installed on the host and invoked by the frontend using the Extension SDK. These executables are useful for interacting with third-party CLI tools. Docker Desktop installs these executables based on the `host` section in `metadata.json` and ensures they are available for the user's platform.