Latest Threat Research:Malicious dYdX Packages Published to npm and PyPI After Maintainer Compromise.Details
Socket
Book a DemoInstallSign in
Socket

docker-compose-run

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docker-compose-run

Execute a Docker Compose 'run' command for desktop commands.

Source
npmnpm
Version
0.2.1
Version published
Weekly downloads
1
-90%
Maintainers
1
Weekly downloads
 
Created
Source

docker-compose-run

This module executes Docker Compose 'run' commands using specific Docker Compose configuration files. The idea is to be able to capture the detail of a particular application and how it should be run, in simple, shareable files.

Example

An example would be to create a way to run Jekyll commands without having to install Jekyll on our desktop.

First create a docker-compose.yml file that describes how to run the Jekyll command, and how to make it accessible to the desktop:

version: "2"
services:
  jekyll:
    image: jekyll/jekyll
    ports:
    - 127.0.0.1:4000:4000
    volumes:
    - ${PWD}:/srv/jekyll

Then create a shell script that uses this module; it could be called anything, but we'll call it dcr-jekyll.js:

#!/usr/bin/env node
var dcr = require('docker-compose-run');

dcr('jekyll', __dirname));

Now when we run this script with a Jekyll command, a Docker container will be created and launched, and our command will be passed in to it:

$ ./dcr-jekyll --help
jekyll 3.4.3 -- Jekyll is a blog-aware, static site generator in Ruby

Usage:

  jekyll <subcommand> [options]

Options:
        -s, --source [DIR]  Source directory (defaults to ./)
        -d, --destination [DIR]  Destination directory (defaults to ./_site)
            --safe         Safe mode (defaults to false)
        -p, --plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]  Plugins directory (defaults to ./_plugins)
            --layouts DIR  Layouts directory (defaults to ./_layouts)
            --profile      Generate a Liquid rendering profile
        -h, --help         Show this message
        -v, --version      Print the name and version
        -t, --trace        Show the full backtrace when an error occurs

Subcommands:
  import
  build, b              Build your site
  clean                 Clean the site (removes site output and metadata file) without building.
  doctor, hyde          Search site and print specific deprecation warnings
  help                  Show the help message, optionally for a given subcommand.
  new                   Creates a new Jekyll site scaffold in PATH
  new-theme             Creates a new Jekyll theme scaffold
  serve, server, s      Serve your site locally
  docs, d               Start a local server for the Jekyll documentation

API

The module provides a single function that takes two parameters:

  • the name of the application to run, and;
  • the directory in which the docker-compose.yml file is located.

The application name is used in two ways; the first is as a key into the Docker Compose file, and the second is as the name of the command to run within the Docker container.

Keywords

docker

FAQs

Package last updated on 22 Jul 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