Share feedback
Answers are generated based on the documentation.
{ const container = $el; // The div with overflow const item = document.getElementById('sidebar-current-page') if (item) { const containerTop = container.scrollTop; const containerBottom = containerTop + container.clientHeight; const itemTop = item.offsetTop - container.offsetTop; const itemBottom = itemTop + item.offsetHeight; // Scroll only if the item is out of view if (itemBottom > containerBottom - 200) { container.scrollTop = itemTop - (container.clientHeight / 2 - item.offsetHeight / 2); } } })" class="bg-background-toc dark:bg-background-toc fixed top-0 z-40 hidden h-screen w-full flex-none overflow-x-hidden overflow-y-auto md:sticky md:top-16 md:z-auto md:block md:h-[calc(100vh-64px)] md:w-[320px]" :class="{ 'hidden': ! $store.showSidebar }">

Interface: Docker

Since

0.2.0

Properties

cli

Readonly cli: DockerCommand

You can also directly execute the Docker binary.

const output = await ddClient.docker.cli.exec("volume", [
  "ls",
  "--filter",
  "dangling=true"
]);

Output:

{
  "stderr": "...",
  "stdout": "..."
}

For convenience, the command result object also has methods to easily parse it depending on output format. See ExecResult instead.


Streams the output as a result of the execution of a Docker command. It is useful when the output of the command is too long, or you need to get the output as a stream.

await ddClient.docker.cli.exec("logs", ["-f", "..."], {
  stream: {
    onOutput(data): void {
        // As we can receive both `stdout` and `stderr`, we wrap them in a JSON object
        JSON.stringify(
          {
            stdout: data.stdout,
            stderr: data.stderr,
          },
          null,
          "  "
        );
    },
    onError(error: any): void {
      console.error(error);
    },
    onClose(exitCode: number): void {
      console.log("onClose with exit code " + exitCode);
    },
  },
});

Methods

listContainers

listContainers(options?): Promise<unknown>

Get the list of running containers (same as docker ps).

By default, this will not list stopped containers. You can use the option {"all": true} to list all the running and stopped containers.

const containers = await ddClient.docker.listContainers();

Parameters

NameTypeDescription
options?any(Optional). A JSON like { "all": true, "limit": 10, "size": true, "filters": JSON.stringify({ status: ["exited"] }), } For more information about the different properties see the Docker API endpoint documentation.

Returns

Promise<unknown>


listImages

listImages(options?): Promise<unknown>

Get the list of local container images

const images = await ddClient.docker.listImages();

Parameters

NameTypeDescription
options?any(Optional). A JSON like { "all": true, "filters": JSON.stringify({ dangling: ["true"] }), "digests": true * } For more information about the different properties see the Docker API endpoint documentation.

Returns

Promise<unknown>