Files
cloudron-box/src/docker.js

24 lines
573 B
JavaScript
Raw Normal View History

'use strict';
var Docker = require('dockerode');
exports = module.exports = {
connection: connectionInstance()
};
function connectionInstance() {
var docker;
if (process.env.BOX_ENV === 'test') {
// test code runs a docker proxy on this port
docker = new Docker({ host: 'http://localhost', port: 5687 });
// proxy code uses this to route to the real docker
docker.options = { socketPath: '/var/run/docker.sock' };
} else {
docker = new Docker({ socketPath: '/var/run/docker.sock' });
}
return docker;
}