# docker-remote-api

> Basic http wrapper to call the docker remote api from node

Latest version **5.0.0** (published 2018-03-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install docker-remote-api
pnpm add docker-remote-api
yarn add docker-remote-api
bun add docker-remote-api
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2018-03-21 |
| First published | 2014-07-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 56 |
| Author | Mathias Buus |
| Maintainers | mafintosh |
| Keywords | docker, remote, api, http, https, request |

## Links

- npm: https://www.npmjs.com/package/docker-remote-api
- Repository: https://github.com/mafintosh/docker-remote-api
- Issues: https://github.com/mafintosh/docker-remote-api/issues
- npm.io page: https://npm.io/package/docker-remote-api

## Dependencies (4)

- [once](https://npm.io/package/once.md) ^1.3.0
- [xtend](https://npm.io/package/xtend.md) ^3.0.0
- [docker-host](https://npm.io/package/docker-host.md) ^3.0.0
- [concat-stream](https://npm.io/package/concat-stream.md) ^1.4.6

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 5.0.0 (latest) — 2018-03-21
- 4.4.1 — 2015-02-11
- 4.4.0 — 2014-10-19
- 4.3.0 — 2014-10-08
- 4.2.0 — 2014-10-03
- 4.1.0 — 2014-09-10
- 4.0.0 — 2014-09-10
- 3.1.0 — 2014-09-10
- 3.0.0 — 2014-09-09
- 2.2.0 — 2014-07-24
- 2.1.1 — 2014-07-10
- 2.1.0 — 2014-07-10
- 2.0.5 — 2014-07-10
- 2.0.4 — 2014-07-10
- 2.0.3 — 2014-07-10
- … 5 more at https://npm.io/package/docker-remote-api/versions

## README

# docker-remote-api

Basic http wrapper to call the docker remote api from node

```
npm install docker-remote-api
```

[![build status](http://img.shields.io/travis/mafintosh/docker-remote-api.svg?style=flat)](http://travis-ci.org/mafintosh/docker-remote-api)

## Usage

``` js
var docker = require('docker-remote-api')
var request = docker({
  host: '/var/run/docker.sock'
})

request.get('/images/json', {json:true}, function(err, images) {
  if (err) throw err
  console.log('images', images)
})

request.get('/images/json', function(err, stream) {
  if (err) throw err
  // stream is a raw response stream
})
```

## API

#### `request = docker(options)`

`options.host` should be an address to a docker instance i.e. `/var/run/docker.sock` or `127.0.0.1:2375`.
All other options will be used as default values for `get`, `post`, `put`, `delete`.

If you omit the `options.host` it will be set to `$DOCKER_HOST` or `/var/run/docker.sock`

#### `request.get(path, [options], cb)`

Send a `GET` request to the remote api. `path` should be the request path i.e. `/images/json`.
`options` can contain the following

``` js
{
  qs: {foo:'bar'},        // set querystring parameters
  headers: {name: '...'}, // set request headers
  json: true,             // return json instead of a stream
  buffer: true,           // return a buffer instead of a stream
  drain: true,            // will drain the response stream before calling cb
  timeout: 20000,         // set request timeout
  version: 'v1.14'        // set explicit api version
}
```

#### `request.delete(path, [options], cb)`

Send a `DELETE` request. Similar options as `request.get`

#### `post = request.post(path, [options], cb)`

Send a `POST` request. Similar options as `request.get` except it returns a request stream
that you can pipe a request body to. If you are sending json you can set `options.json = body`
and `body` will be stringified and sent as the request body.

If you do not have a request body set `body: null` or remember to call `post.end()`

#### `put = request.put(path, [options], cb)`

Send a `PUT` request. Similar options as `request.post`

## License

MIT

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