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.

        • (containerNameOrId, latestLineCount?): Promise<string>
        • Parameters

          • containerNameOrId: string
          • OptionallatestLineCount: number

          Returns Promise<string>

    • 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.

        • (containerNameOrId, options?): Promise<void>
        • Parameters

          Returns Promise<void>

    • 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.

        • <T>(containerNameOrId, callback): Promise<Awaited<T>>
        • Runs a callback (which presumably runs a command within the given containerName) and kills the given containerName container if the callback fails.

          Type Parameters

          • T

          Parameters

          Returns Promise<Awaited<T>>

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

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

        • (containerNameOrId, failureMessage?): Promise<void>
        • Parameters

          • containerNameOrId: string
          • OptionalfailureMessage: string

          Returns Promise<void>

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

      Wait until a container is completely removed.

        • (containerNameOrId, failureMessage?): Promise<void>
        • Parameters

          • containerNameOrId: string
          • OptionalfailureMessage: string

          Returns Promise<void>

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

      Wait until a container is running and responsive.

        • (containerNameOrId, failureMessage?): Promise<void>
        • Parameters

          • containerNameOrId: string
          • OptionalfailureMessage: string

          Returns Promise<void>

  • 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.

        • (imageName): Promise<boolean>
        • Parameters

          • imageName: string
            'alpine:3.20.2'
            

          Returns Promise<boolean>

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

      Removes an image from the local registry.

        • (imageName): Promise<void>
        • Parameters

          • imageName: string
            'alpine:3.20.2'
            

          Returns Promise<void>

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

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

        • (imageName, platform?): Promise<void>
        • Parameters

          • imageName: string
            'alpine:3.20.2'
            
          • Optionalplatform: string

          Returns Promise<void>

  • isRunning: (() => Promise<boolean>)

    Detects if the Docker service is running.

      • (): Promise<boolean>
      • Returns Promise<boolean>

  • 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.

      • (): Promise<void>
      • Returns Promise<void>

  • 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.

        • (envMapping?): string
        • Parameters

          • OptionalenvMapping: Readonly<Record<string, {
                allowInterpolation: boolean;
                value: string;
            }>>

          Returns string

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

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

        • (portMapping?): string
        • Parameters

          Returns string

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

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

        • (volumeMapping?): string
        • Parameters

          Returns string