# @amazing-kit/docker

> Run docker commands in node.js (not all commands are supported yet)

Latest version **1.0.6** (published 2023-09-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @amazing-kit/docker
pnpm add @amazing-kit/docker
yarn add @amazing-kit/docker
bun add @amazing-kit/docker
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2023-09-13 |
| First published | 2023-09-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 18.0.0 |
| Dependencies | 1 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Frédéric Mascaro |
| Maintainers | wooandoo |
| Keywords | docker |

## Links

- npm: https://www.npmjs.com/package/@amazing-kit/docker
- Repository: https://github.com/amazing-kit/docker
- Homepage: https://github.com/amazing-kit/docker#readme
- Issues: https://github.com/amazing-kit/docker/issues
- npm.io page: https://npm.io/package/@amazing-kit/docker

## Dependencies (1)

- [zx](https://npm.io/package/zx.md) ^7.2.3

## Recent versions

- 1.0.6 (latest) — 2023-09-13
- 1.0.5 — 2023-09-13
- 1.0.4 — 2023-09-13
- 1.0.3 — 2023-09-13
- 1.0.2 — 2023-09-13
- 1.0.1 — 2023-09-13
- 1.0.0 — 2023-09-13

## README

# @amazing-kit/docker

Run docker commands from nodejs
- run
- stop
- ps

## Install

```sh
pnpm add @amazing-kit/docker
```

```ts
// ESModule only
import docker from "@amazing-kit/docker"
```

## Get docker containers

```ts
const all_containers = await docker.ps({ all: true })
// get container data in JSON format
```

## Run a new docker container

```ts
await docker.run("image_name", {
  // all options are optional
  name: "container_name",
  ports: [
    { host: 8080, container: 80 }
  ],
  env: [
    { name: "ENV_NAME", value: "ENV_VALUE"}
  ],
  volumes: [
    { source: "/host/path", container: "/container/path", readonly: true }
  ],
  auto_remove: true, // default false
  daemon: true,      // default false
})
```

## Stop a docker container

```ts
await docker.stop("container_name", { forceKillAfter: 1000 })
```

## Alternatives

- [dockerode](https://github.com/apocas/dockerode)
- [docker-js](https://github.com/giper45/docker-js)
- [zx](https://github.com/google/zx) -> not docker specific (execu docker CLI in JS)

---
_Source: https://npm.io/package/@amazing-kit/docker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
