New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

docker-browser-console-nextjs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docker-browser-console-nextjs

Forward input/output from docker containers to your browser. This repository removes the fs dependency for compatibility with the nextjs framework

  • 7.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source
- This repository removes the fs dependency for compatibility with the nextjs framework

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

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

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

Server usage

Then create a server that will host our docker containers

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

Keywords

FAQs

Package last updated on 16 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc