# docker-browser-console

> Forward input/output from docker containers to your browser

Latest version **6.0.0** (published 2017-09-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install docker-browser-console
pnpm add docker-browser-console
yarn add docker-browser-console
bun add docker-browser-console
```

## 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 | 6.0.0 |
| Published | 2017-09-14 |
| First published | 2014-10-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 88 |
| Author | Mathias Buus |
| Maintainers | mafintosh, maxogden |
| Keywords | docker |

## Links

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

## Dependencies (8)

- [brfs](https://npm.io/package/brfs.md) ^1.2.0
- [xtend](https://npm.io/package/xtend.md) ^4.0.0
- [ndjson](https://npm.io/package/ndjson.md) ^1.2.3
- [term.js](https://npm.io/package/term.js.md) ^0.0.4
- [duplexify](https://npm.io/package/duplexify.md) ^3.2.0
- [defaultcss](https://npm.io/package/defaultcss.md) 0.0.2
- [docker-run](https://npm.io/package/docker-run.md) ^3.0.0
- [computed-style](https://npm.io/package/computed-style.md) ^0.1.3

## Recent versions

- 6.0.0 (latest) — 2017-09-14
- 5.0.0 — 2014-10-25
- 4.3.1 — 2014-10-25
- 4.3.0 — 2014-10-23
- 4.2.0 — 2014-10-23
- 4.1.0 — 2014-10-23
- 4.0.0 — 2014-10-22
- 3.1.0 — 2014-10-22
- 3.0.0 — 2014-10-20
- 2.0.1 — 2014-10-08
- 2.0.0 — 2014-10-07
- 1.0.0 — 2014-10-01
- 0.0.0 — 2014-10-01

## README

# docker-browser-console

Forward input/output from docker containers to your browser

```
npm install docker-browser-console
```

To quickly try out a demo clone this repo and

```
npm install
npm run demo
```

## Browser usage

First browserify the following code to `bundle.js` to create a terminal in your browser

``` js
var docker = require('docker-browser-console')
var websocket = require('websocket-stream')

// create a stream for any docker image
// use docker({style:false}) to disable default styling
// all other options are forwarded to the term.js instance
var terminal = docker()

// connect to a docker-browser-console server
terminal.pipe(websocket('ws://localhost:10000')).pipe(terminal)

// append the terminal to a DOM element
terminal.appendTo(document.body)
```

You can add that to an `index.html` page by doing

``` html
<!DOCTYPE html>
<html>
<body>
  <script src="bundle.js">
</body>
</html>
```

## Server usage

Then create a server that will host our docker containers

``` js
var ws = require('ws')
var websocket = require('websocket-stream')
var docker = require('docker-browser-console')

var server = new ws.Server({port:10000})

server.on('connection', function(socket) {
  socket = websocket(socket)
  // this will spawn the container and forward the output to the browser
  socket.pipe(docker('mafintosh/dev')).pipe(socket)
})
```

Now simply run the server and open `index.html` in your browser.
You should be able to see a terminal running my dev image

## License

MIT

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