Skip to content

unalterable/docker-starter

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

Docker Starter

A simple npm module that allows you to start and stop docker containers from node, using shelljs to pass docker commands to the command line.

Designed to work on Linux distributions, and Mac (Darwin).

Because this package works by passing commands to the unix command line - you must already have the docker client installed and on $PATH. i.e. if you can run docker ps on the command line - then you should be good to go.

Installation:

npm install docker-starter

Example:

const dockerStarter = require('docker-starter');

const mongo = dockerStarter({
  container: 'db-test',
  image: 'mongo:4.0.4',
  extraOptions: '--restart on-failure:5',
  containerPort: 27017,
  publishedPort: 27019,
});

const { host, port, wasAlreadyRunning } = mongo.ensureRunning();

// do some stuff requiring mongo

mongo.stopAndRemove();

About

This module allows you to start and stop docker containers from node, using shelljs to pass docker commands to the command line

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published