diff --git a/src/docker.js b/src/docker.js index 46adb62bc..63e3889a8 100644 --- a/src/docker.js +++ b/src/docker.js @@ -190,22 +190,22 @@ function getBinds(app, callback) { assert.strictEqual(typeof app, 'object'); assert.strictEqual(typeof callback, 'function'); - if (!app.volumes || app.volumes.length === 0) return callback(null); + if (app.mounts.length === 0) return callback(null); let binds = []; volumes.list(function (error, result) { if (error) return callback(error); + let volumesById = {}; + result.forEach(r => volumesById[r.id] = r); - for (const volume of result) { - const appVolume = app.volumes.find(v => v.id === volume.id); - if (!appVolume) continue; - - binds.push(`${volume.hostPath}:/media/${volume.name}:${appVolume.readOnly ? 'ro' : 'rw'}`); + for (const mount of app.mounts) { + const volume = volumesById[mount.volumeId]; + binds.push(`${volume.hostPath}:/media/${volume.name}:${mount.readOnly ? 'ro' : 'rw'}`); } - }); - return binds; + callback(null, binds); + }); } function createSubcontainer(app, name, cmd, options, callback) {