Also allow docker in containers spawned by an authorized app
This commit is contained in:
@@ -14,6 +14,7 @@ exports = module.exports = {
|
||||
deleteContainers: deleteContainers,
|
||||
createSubcontainer: createSubcontainer,
|
||||
getContainerIdByIp: getContainerIdByIp,
|
||||
getAppIdByContainerIp: getAppIdByContainerIp,
|
||||
inspect: inspect,
|
||||
inspectByName: inspect,
|
||||
execContainer: execContainer
|
||||
@@ -384,6 +385,24 @@ function getContainerIdByIp(ip, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function getAppIdByContainerIp(ip, callback) {
|
||||
assert.strictEqual(typeof ip, 'string');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
getContainerIdByIp(ip, function (error, containerId) {
|
||||
if (error) return callback(error);
|
||||
|
||||
inspect(containerId, function (error, result) {
|
||||
if (error) return callback(error);
|
||||
|
||||
var appId = result.Config.Labels.appId;
|
||||
if (!appId) return callback(new Error('No app associated with this ip'));
|
||||
|
||||
callback(null, appId);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function inspect(containerId, callback) {
|
||||
assert.strictEqual(typeof containerId, 'string');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
Reference in New Issue
Block a user