var Docker = require('../lib/docker');
var fs     = require('fs');

// For Mac OS X:
// socat -d -d unix-l:/tmp/docker.sock,fork tcp:<docker-host>:4243
// DOCKER_SOCKET=/tmp/docker.sock npm test


var socket = process.env.DOCKER_SOCKET || '/var/run/docker.sock';
var stats  = fs.statSync(socket);
var docker;

if (!stats.isSocket()) {
  console.log('Trying TCP connection...');
  docker = new Docker({host: process.env.DOCKER_HOST || 'http://127.0.0.1', port: process.env.DOCKER_PORT || 3000});
  dockert = new Docker({host: process.env.DOCKER_HOST || 'http://127.0.0.1', port: process.env.DOCKER_PORT || 3000, timeout: 1});
} else {
  docker = new Docker({ socketPath: socket });
  dockert = new Docker({ socketPath: socket, timeout: 1 });
}

module.exports = {
  'docker': docker,
  'dockert': dockert
};

@@ -201,16 +201,18 @@
  socket 
+  
 = proces
@@ -266,16 +266,42 @@
 var 
-stats  =
+isSocket = fs.existsSync(socket) ?
  fs.
@@ -316,16 +316,35 @@
 (socket)
+.isSocket() : false
 ;%0Avar do
@@ -359,22 +359,16 @@
 f (!
-stats.
 isSocket
 ()) 
@@ -363,18 +363,16 @@
 isSocket
-()
 ) %7B%0A  co

Fix for missing socket