'use strict';

// Modules
var request = require('request');

module.exports = function( image, callback ){

  request.get( 'http://' + process.env.HOST_IP + ':2375/containers/json?all=true', function( error, http, body ){

    var containers = JSON.parse( body ).filter(function ( item ) {
      return item.Image === image;
    });

    async.map( containers, function ( item, callback ) {

      request.post( 'http://' + process.env.HOST_IP + ':2375/containers' + item.Id + '/kill', function ( err, http, body ) {

        if ( err ) return callback( err );

        request.del('http://' + process.env.HOST_IP + ':2375/images/' + image, function ( err, http, body ) {
           callback( err );
        });

      });

    }, function ( err ) {
      callback(err);
    });

  });

};

@@ -403,12 +403,11 @@
 est.
-post
+del
 ( 'h
@@ -455,16 +455,17 @@
 ntainers
+/
 ' + item
@@ -475,13 +475,19 @@
  + '
-/kill
+?force=true
 ', f
@@ -535,16 +535,27 @@
  ( err )
+%7B%0A         
  return 
@@ -570,16 +570,26 @@
 ( err );
+%0A        %7D
 %0A%0A      
@@ -688,25 +688,24 @@
 p, body ) %7B%0A
- 
           ca

Remove containers properly