Skip to content

rjchicago/docker-node-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-node-demo

A crude NodeJS demo app attaching the local Docker socket that exposes the Docker CLI via REST.

INTENDED FOR LOCAL DEMO PURPOSES ONLY!

This exposes the Docker CLI via REST. You DO NOT want this running in production. Or anywhere really for that matter.

DO NOT RUN THIS ANYWHERE

^^^ just to be clear.

Running Docker Node Demo

Ok, so you want to run this locally - just to test it out...

To run locally, simply clone this repo and compose up...

git clone https://github.com/rjchicago/docker-node-demo.git

cd docker-node-demo

docker-compose up --build

open http://localhost:3000/ps

samples links

Format JSON

You can format many docker command results as json. For example

curl -H 'accept: application/json' http://localhost:3000/container/ls | jq

or via query param...

http://localhost:3000/container/ls?format=application/json

Segment Templating

You may provide segment templates to be replaced by query params.

Tip: you may pass multiple query params of the same name. (i.e. to support multiple ports or volumes)

Example:

http://localhost:3000/run/--name/hello_nginx/-d/--rm/port/nginx?port=-p%208080:80&port=-p%208888:80

Then check the process is running...

http://localhost:3000/ps/filter/format?format=--format%20%22{{json%20.}}%22&filter=--filter%20%22name=hello_nginx%22

Then see it working...

Welcome to nginx!

Finally, stop the nginx container

http://localhost:3000/container/kill/hello_nginx

About

Demo App using NodeJS and Docker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published