v0.3.0
A Docker client library for Deno with extra commands
Repository
Current version released
8 months ago
Dependencies
deno.land/x
Versions
Denocker
A fully typed, async-first docker client library for Deno.
Installation
import Docker from "https://deno.land/x/denocker/mod.ts"
Usage
Simple example
import Docker from "https://deno.land/x/denocker/mod.ts"
const docker = new Docker("/var/run/docker.sock");
const container = await docker.containers.create("my_container", {
Image: "alpine",
Cmd: ["ls"],
StopTimeout: 10,
});
await docker.containers.start(container.Id);
Manipulating containers
// Fetch the list of currently running containers
const containers = await docker.containers.list({all: true});
// Create a container
const container = await docker.containers.create("my_container", {
Image: "alpine",
Cmd: ["echo", "hello"],
});
// Start the container
await docker.containers.start(container.Id);
// Stop a container
await docker.containers.stop(container.Id);
// Kill a container
await docker.containers.kill(container.Id, "SIGKILL");
// Restart a container
await docker.containers.restart(container.Id);
// Wait until the container has finished running
await docker.container.wait(container.Id);
// Delete a container
await docker.containers.rm(container.Id);
Images
// List images
await docker.images.list(ImageListOptions)
// Create Image
await docker.images.create('ubuntu', {"fromImage": "ubuntu", tag: 'latest'})
API reference
Containers
containers.list
- Docker APIcontainers.create
- Docker APIcontainers.start
- Docker APIcontainers.stop
- Docker APIcontainers.kill
- Docker APIcontainers.restart
- Docker APIcontainers.wait
- Docker APIcontainers.rm
- Docker API
Image
image.list
- Docker API