Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

docker-sidecar

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-sidecar - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

docker-events.js

32

bin/sidecar.js

@@ -8,3 +8,10 @@ #!/usr/bin/env node

const rc = require('rc');
const os = require('os');
const join = require('path').join;
let dockerAuth;
try {
dockerAuth = require(join(os.homedir(), '.docker', 'config.json')).auths;
} catch (_) {
}
const cfg = rc('sidecar', {

@@ -18,10 +25,3 @@ consul: 'http://127.0.0.1:8500',

},
docker: {
'index.docker.io': {
email: undefined,
auth: undefined,
username: undefined,
password: undefined
}
}
docker: dockerAuth
}

@@ -95,7 +95,7 @@ }, require('minimist')(process.argv, {

puller.watch.on('error', function (err) {
puller.watch.on('error', (err) => {
log.error({err: err}, 'watch error');
});
puller.watch.on('change', function (data, res) {
puller.watch.on('change', (data, res) => {
log.debug({data: data}, 'dir change');

@@ -105,11 +105,17 @@ puller.pull();

puller.docker.on('error', function (err) {
puller.docker.on('error', (err) => {
console.error(err.stack);
log.error({err: err}, 'docker error');
});
puller.docker.on('finish', function (output) {
log.info({finalStatus: output.slice(-1)}, 'docker finished');
puller.docker.on('pull', (pull) => {
log.info({pull: pull}, 'docker pull');
});
puller.docker.on('engine_connect', (event) => {
log.debug({event: event}, 'engine_connnect');
puller.pull();
});
log.info('initialized sidecar');
}).done();

@@ -8,5 +8,5 @@ 'use strict';

const assert = require('assert');
const method = Bluebird.method;
const getEvents = require('./docker-events');
const sidecar = method(function (opts) {
const sidecar = co.wrap(function *(opts) {
opts = opts || {};

@@ -18,6 +18,13 @@ const consul = opts.consul;

const dockerAuth = opts.dockerAuth;
const dockerEvents = yield getEvents(docker);
dockerEvents.on('data', (event) => {
if (typeof event.status === 'string') {
out.emit(event.status, event);
}
});
function onFinished (err, output) {
// output is an array with output json parsed objects
if (err) {
out.emit(err);
out.emit('error', err);
} else {

@@ -38,3 +45,3 @@ out.emit('finish', output);

const images = keyval.filter(Boolean).map(k => k.Value).filter(Boolean);
debug('images: %j', images);
debug('images: %j, auths: %j', images, dockerAuth);
for (let image of images) {

@@ -41,0 +48,0 @@ const registries = Object.keys(dockerAuth).filter((registry) => image.indexOf(registry) === 0);

{
"name": "docker-sidecar",
"version": "1.1.0",
"version": "1.2.0",
"description": "Watch a consul kv dir for changes to retrieve a list of images and tags and pull them into docker when kv prefix changes.",

@@ -24,4 +24,6 @@ "main": "index.js",

"dockerode": "^2.2.9",
"jsonstream2": "^1.1.1",
"minimist": "^1.2.0",
"rc": "^1.1.6",
"split2": "^2.0.1",
"xtend": "^4.0.1"

@@ -28,0 +30,0 @@ },

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