docker-tools
Advanced tools
Comparing version 0.0.2 to 1.0.0
@@ -30,3 +30,12 @@ module.exports = function createDockerContainerOptions (spec) { | ||
if (spec.hostPort && spec.port) { | ||
options['HostConfig']['PortBindings'] = {}; | ||
if (typeof spec.hostPort === 'number') { | ||
options['HostConfig']['PortBindings']['' + spec.port + '/tcp'] = [{ | ||
'HostPort': '' + spec.hostPort | ||
}]; | ||
} | ||
} | ||
return options; | ||
}; |
{ | ||
"name": "docker-tools", | ||
"description": "Tools for working with Docker containers in Node.js.", | ||
"version": "0.0.2", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"author": "Gustav Nikolaj Olsen @gustavnikolaj <gno@one.com>", | ||
"license": "BSD-3-Clause", | ||
"scripts": { | ||
@@ -7,0 +9,0 @@ "lint": "onelint", |
@@ -17,2 +17,37 @@ var expect = require('unexpected'); | ||
}); | ||
it("should map 'hostPort' to PortBindings", function () { | ||
return expect(createDockerContainerOptions({ | ||
image: 'redis', | ||
port: 5432, | ||
hostPort: 54321 | ||
}), 'to equal', { | ||
Image: 'redis', | ||
ExposedPorts: { | ||
'5432/tcp': {} | ||
}, | ||
HostConfig: { | ||
PublishAllPorts: true, | ||
PortBindings: { | ||
'5432/tcp': [{ | ||
HostPort: '54321' | ||
}] | ||
} | ||
} | ||
}); | ||
}); | ||
it("should not map 'hostPort' to PortBindings of 'port' has not been configured", function () { | ||
return expect(createDockerContainerOptions({ | ||
image: 'redis', | ||
hostPort: 54321 | ||
}), 'to equal', { | ||
Image: 'redis', | ||
ExposedPorts: undefined, | ||
HostConfig: { | ||
PublishAllPorts: true, | ||
PortBindings: undefined | ||
} | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
23117
17
0
537
1
0
1