@zuke/docker
`@zuke/docker` — typed `docker` CLI task wrappers for Zuke builds.
@zuke/docker on JSR ↗ 18 symbols
Symbols
class DockerBuildSettings extends DockerSettings Settings for docker build.
| Member | Signature | Doc |
|---|---|---|
tag | tag(reference: string): this | Add an image tag (-t); repeatable. |
file | file(path: PathLike): this | Use an explicit Dockerfile (-f). |
target | target(stage: string): this | Build a specific stage (--target). |
platform | platform(value: string): this | Set the target platform(s) (--platform). |
buildArg | buildArg(key: string, value: string): this | Pass a build-time variable (--build-arg KEY=value); repeatable. |
noCache | noCache(): this | Do not use the layer cache (--no-cache). |
pull | pull(): this | Always attempt to pull newer base images (--pull). |
push | push(): this | Push the result to the registry after building (--push). |
context | context(path: PathLike): this | The build context path or URL (default .). |
class DockerExecSettings extends DockerSettings Settings for docker exec.
| Member | Signature | Doc |
|---|---|---|
container | container(name: string): this | The target container (required). |
interactive | interactive(): this | Keep STDIN open (-i). |
tty | tty(): this | Allocate a pseudo-TTY (-t). |
envVar | envVar(key: string, value: string): this | Set an environment variable for the command (-e KEY=value). |
workdir | workdir(path: PathLike): this | Working directory inside the container (-w). |
commandArgs | commandArgs(...args: Array<string | number>): this | The command and arguments to execute. |
class DockerImagesSettings extends DockerSettings Settings for docker images.
| Member | Signature | Doc |
|---|---|---|
all | all(): this | Show all images, including intermediate layers (-a). |
quietOutput | quietOutput(): this | Only show image IDs (-q). |
filter | filter(expression: string): this | Filter the listing (--filter); repeatable. |
repository | repository(name: string): this | Restrict to a repository (positional argument). |
class DockerLoadSettings extends DockerSettings Settings for docker load.
| Member | Signature | Doc |
|---|---|---|
input | input(path: PathLike): this | Read from a tar archive instead of STDIN (-i). |
quietOutput | quietOutput(): this | Suppress the load output (-q). |
class DockerLoginSettings extends DockerSettings Settings for docker login.
| Member | Signature | Doc |
|---|---|---|
username | username(value: string): this | The username (-u). |
password | password(value: string): this | The password (-p). This lands directly in the process argv, where it can leak through ps/process listings, shell history, or CI job logs — passwordStdin is the safe choice in CI (and generally), since it pipes the secret through STDIN instead of putting it on the command line. |
passwordStdin | passwordStdin(): this | Read the password from STDIN (--password-stdin). |
registry | registry(server: string): this | The registry server (defaults to Docker Hub). |
class DockerPsSettings extends DockerSettings Settings for docker ps.
| Member | Signature | Doc |
|---|---|---|
all | all(): this | Show stopped containers too (-a). |
quietOutput | quietOutput(): this | Only show container IDs (-q). |
filter | filter(expression: string): this | Filter the listing (--filter); repeatable. |
class DockerPullSettings extends DockerSettings Settings for docker pull.
| Member | Signature | Doc |
|---|---|---|
image | image(reference: string): this | The image reference to pull (required). |
platform | platform(value: string): this | Pull a specific platform (--platform). |
quietOutput | quietOutput(): this | Suppress verbose output (-q). |
class DockerPushSettings extends DockerSettings Settings for docker push.
| Member | Signature | Doc |
|---|---|---|
image | image(reference: string): this | The image reference to push (required). |
allTags | allTags(): this | Push every tag of the repository (--all-tags). |
class DockerRmiSettings extends DockerSettings Settings for docker rmi.
| Member | Signature | Doc |
|---|---|---|
images | images(...references: string[]): this | The images to remove (at least one is required). |
force | force(): this | Force removal (-f). |
class DockerRmSettings extends DockerSettings Settings for docker rm.
| Member | Signature | Doc |
|---|---|---|
containers | containers(...names: string[]): this | The containers to remove (at least one is required). |
force | force(): this | Force removal of a running container (-f). |
volumes | volumes(): this | Also remove anonymous volumes (-v). |
class DockerRunSettings extends DockerSettings Settings for docker run.
| Member | Signature | Doc |
|---|---|---|
image | image(reference: string): this | The image to run (required). |
name | name(value: string): this | Assign a container name (--name). |
rm | rm(): this | Remove the container when it exits (--rm). |
detach | detach(): this | Run the container in the background (-d). |
interactive | interactive(): this | Keep STDIN open (-i). |
tty | tty(): this | Allocate a pseudo-TTY (-t). |
envVar | envVar(key: string, value: string): this | Set a container environment variable (-e KEY=value); repeatable. |
publish | publish(host: string | number, container: string | number): this | Publish a container port to the host (-p host:container). |
volume | volume(source: PathLike, target: PathLike): this | Bind-mount or attach a volume (-v source:target). |
network | network(value: string): this | Connect the container to a network (--network). |
commandArgs | commandArgs(...args: Array<string | number>): this | The command and arguments to run inside the container. |
class DockerSaveSettings extends DockerSettings Settings for docker save.
| Member | Signature | Doc |
|---|---|---|
images | images(...references: string[]): this | The images to save (at least one is required). |
output | output(path: PathLike): this | Write to a file instead of STDOUT (-o). |
class DockerSettings extends ToolSettings Base for all docker subcommand settings: the binary is docker.
class DockerStartSettings extends DockerSettings Settings for docker start.
| Member | Signature | Doc |
|---|---|---|
containers | containers(...names: string[]): this | The containers to start (at least one is required). |
attach | attach(): this | Attach STDOUT/STDERR and forward signals (-a). |
class DockerStopSettings extends DockerSettings Settings for docker stop.
| Member | Signature | Doc |
|---|---|---|
containers | containers(...names: string[]): this | The containers to stop (at least one is required). |
time | time(seconds: number): this | Seconds to wait before killing (-t). |
class DockerTagSettings extends DockerSettings Settings for docker tag.
| Member | Signature | Doc |
|---|---|---|
source | source(reference: string): this | The existing image reference (required). |
target | target(reference: string): this | The new image reference (required). |
const DockerTasks: DockerTasksApi Typed task functions for the docker CLI.
interface DockerTasksApi The shape of DockerTasks.
| Member | Signature | Doc |
|---|---|---|
build | build(configure?: Configure<DockerBuildSettings>): Promise<CommandOutput> | Build an image: docker build. |
run | run(configure?: Configure<DockerRunSettings>): Promise<CommandOutput> | Run a container: docker run. |
exec | exec(configure?: Configure<DockerExecSettings>): Promise<CommandOutput> | Run a command in a container: docker exec. |
push | push(configure?: Configure<DockerPushSettings>): Promise<CommandOutput> | Push an image: docker push. |
pull | pull(configure?: Configure<DockerPullSettings>): Promise<CommandOutput> | Pull an image: docker pull. |
tag | tag(configure?: Configure<DockerTagSettings>): Promise<CommandOutput> | Tag an image: docker tag. |
login | login(configure?: Configure<DockerLoginSettings>): Promise<CommandOutput> | Authenticate to a registry: docker login. |
images | images(configure?: Configure<DockerImagesSettings>): Promise<CommandOutput> | List images: docker images. |
ps | ps(configure?: Configure<DockerPsSettings>): Promise<CommandOutput> | List containers: docker ps. |
stop | stop(configure?: Configure<DockerStopSettings>): Promise<CommandOutput> | Stop containers: docker stop. |
start | start(configure?: Configure<DockerStartSettings>): Promise<CommandOutput> | Start containers: docker start. |
rm | rm(configure?: Configure<DockerRmSettings>): Promise<CommandOutput> | Remove containers: docker rm. |
rmi | rmi(configure?: Configure<DockerRmiSettings>): Promise<CommandOutput> | Remove images: docker rmi. |
save | save(configure?: Configure<DockerSaveSettings>): Promise<CommandOutput> | Save images to a tar archive: docker save. |
load | load(configure?: Configure<DockerLoadSettings>): Promise<CommandOutput> | Load images from a tar archive: docker load. |