Variable dockerConst

docker: {
    container: {
        copyTo: (
            __namedParameters: CopyToDockerContainerParams,
        ) => Promise<void>;
        getInfo: (
            containerNameOrId: string,
        ) => Promise<DockerContainerInfo | undefined>;
        getLogs: (
            containerNameOrId: string,
            latestLineCount?: number,
        ) => Promise<string>;
        getStatus: (containerNameOrId: string) => Promise<DockerContainerStatus>;
        kill: (
            containerNameOrId: string,
            options?: PartialWithUndefined<{ keepContainer: boolean }>,
        ) => Promise<void>;
        run: (__namedParameters: RunDockerContainerParams) => Promise<void>;
        runCommand: (
            __namedParameters: RunDockerContainerCommandParams,
        ) => Promise<ShellOutput>;
        tryOrKill: <T>(
            containerNameOrId: string,
            callback: (containerNameOrId: string) => MaybePromise<T>,
        ) => Promise<Awaited<T>>;
        waitUntilExited: (
            containerNameOrId: string,
            failureMessage?: string,
        ) => Promise<void>;
        waitUntilRemoved: (
            containerNameOrId: string,
            failureMessage?: string,
        ) => Promise<void>;
        waitUntilRunning: (
            containerNameOrId: string,
            failureMessage?: string,
        ) => Promise<void>;
    };
    image: {
        exists: (imageName: string) => Promise<boolean>;
        remove: (imageName: string) => Promise<void>;
        update: (imageName: string, platform?: string) => Promise<void>;
    };
    isRunning: () => Promise<boolean>;
    start: () => Promise<void>;
    util: {
        makeEnvFlags: (
            envMapping?: Readonly<
                Record<string, { allowInterpolation: boolean; value: string }>,
            >,
        ) => string;
        makePortMapFlags: (portMapping?: readonly DockerPortMap[]) => string;
        makeVolumeFlags: (volumeMapping?: readonly DockerVolumeMap[]) => string;
    };
} = ...

Centralized Docker API from @augment-vir/node.

Type declaration

  • container: {
        copyTo: (
            __namedParameters: CopyToDockerContainerParams,
        ) => Promise<void>;
        getInfo: (
            containerNameOrId: string,
        ) => Promise<DockerContainerInfo | undefined>;
        getLogs: (
            containerNameOrId: string,
            latestLineCount?: number,
        ) => Promise<string>;
        getStatus: (containerNameOrId: string) => Promise<DockerContainerStatus>;
        kill: (
            containerNameOrId: string,
            options?: PartialWithUndefined<{ keepContainer: boolean }>,
        ) => Promise<void>;
        run: (__namedParameters: RunDockerContainerParams) => Promise<void>;
        runCommand: (
            __namedParameters: RunDockerContainerCommandParams,
        ) => Promise<ShellOutput>;
        tryOrKill: <T>(
            containerNameOrId: string,
            callback: (containerNameOrId: string) => MaybePromise<T>,
        ) => Promise<Awaited<T>>;
        waitUntilExited: (
            containerNameOrId: string,
            failureMessage?: string,
        ) => Promise<void>;
        waitUntilRemoved: (
            containerNameOrId: string,
            failureMessage?: string,
        ) => Promise<void>;
        waitUntilRunning: (
            containerNameOrId: string,
            failureMessage?: string,
        ) => Promise<void>;
    }
    • copyTo: (__namedParameters: CopyToDockerContainerParams) => Promise<void>

      Copy a file or directory to a container.

    • getInfo: (containerNameOrId: string) => Promise<DockerContainerInfo | undefined>

      Run docker inspect on a container and return its output.

    • getLogs: (containerNameOrId: string, latestLineCount?: number) => Promise<string>

      Get a container's logs.

    • getStatus: (containerNameOrId: string) => Promise<DockerContainerStatus>

      Get the current status of a container. If the container does not exist at all, the status will be DockerContainerStatus.Removed.

    • kill: (
          containerNameOrId: string,
          options?: PartialWithUndefined<{ keepContainer: boolean }>,
      ) => Promise<void>

      Kill a container.

    • run: (__namedParameters: RunDockerContainerParams) => Promise<void>

      Run a container that isn't already running.

    • runCommand: (__namedParameters: RunDockerContainerCommandParams) => Promise<ShellOutput>

      Run a command on a container that is already running.

    • tryOrKill: <T>(
          containerNameOrId: string,
          callback: (containerNameOrId: string) => MaybePromise<T>,
      ) => Promise<Awaited<T>>

      Runs a callback (which presumably will run a command within the given containerName) and kills the container if the callback fails.

    • waitUntilExited: (containerNameOrId: string, failureMessage?: string) => Promise<void>

      Wait until a container has a status that can be classified as "exited".

    • waitUntilRemoved: (containerNameOrId: string, failureMessage?: string) => Promise<void>

      Wait until a container is completely removed.

    • waitUntilRunning: (containerNameOrId: string, failureMessage?: string) => Promise<void>

      Wait until a container is running and responsive.

  • image: {
        exists: (imageName: string) => Promise<boolean>;
        remove: (imageName: string) => Promise<void>;
        update: (imageName: string, platform?: string) => Promise<void>;
    }
    • exists: (imageName: string) => Promise<boolean>

      Detects if an image exists in the local registry.

    • remove: (imageName: string) => Promise<void>

      Removes an image from the local registry.

    • update: (imageName: string, platform?: string) => Promise<void>

      Downloads an image if it is missing from the local registry.

  • isRunning: () => Promise<boolean>

    Detects if the Docker service is running.

  • start: () => Promise<void>

    Tries to start Docker based ont he current operating system's supported commands. The success of this operation is heavily dependent on how you have Docker setup on your system.

  • util: {
        makeEnvFlags: (
            envMapping?: Readonly<
                Record<string, { allowInterpolation: boolean; value: string }>,
            >,
        ) => string;
        makePortMapFlags: (portMapping?: readonly DockerPortMap[]) => string;
        makeVolumeFlags: (volumeMapping?: readonly DockerVolumeMap[]) => string;
    }
    • makeEnvFlags: (
          envMapping?: Readonly<
              Record<string, { allowInterpolation: boolean; value: string }>,
          >,
      ) => string

      Manually create a string of env mapping flags. This is automatically done already inside the run container methods.

    • makePortMapFlags: (portMapping?: readonly DockerPortMap[]) => string

      Manually create a string of port mapping flags. This is automatically done already inside the run container methods.

    • makeVolumeFlags: (volumeMapping?: readonly DockerVolumeMap[]) => string

      Manually create a string of volume mapping flags. This is automatically done already inside the run container methods.