diff --git a/src/apptask.js b/src/apptask.js index 3ea488583..85bb57994 100644 --- a/src/apptask.js +++ b/src/apptask.js @@ -136,7 +136,9 @@ function unconfigureNginx(app, callback) { } function createContainer(app, callback) { - docker.createContainer(app, function (error, container) { + assert(!app.containerId); // otherwise, it will trigger volumeFrom + + docker.createContainer(app, null /* command */, function (error, container) { if (error) return callback(new Error('Error creating container: ' + error)); updateApp(app, { containerId: container.id }, callback); diff --git a/src/docker.js b/src/docker.js index 9539a297f..a655a0562 100644 --- a/src/docker.js +++ b/src/docker.js @@ -114,8 +114,9 @@ function downloadImage(manifest, callback) { }, callback); } -function createContainer(app, callback) { +function createContainer(app, cmd, callback) { assert.strictEqual(typeof app, 'object'); + assert(!cmd || util.isArray(cmd)); assert.strictEqual(typeof callback, 'function'); var docker = exports.connection; @@ -155,7 +156,7 @@ function createContainer(app, callback) { Hostname: config.appFqdn(app.location), Tty: true, Image: app.manifest.dockerImage, - Cmd: null, + Cmd: cmd, Env: stdEnv.concat(addonEnv).concat(portEnv), ExposedPorts: exposedPorts, Volumes: { // see also ReadonlyRootfs @@ -180,7 +181,8 @@ function createContainer(app, callback) { }, CpuShares: 512, // relative to 1024 for system processes SecurityOpt: config.CLOUDRON ? [ "apparmor:docker-cloudron-app" ] : null // profile available only on cloudron - } + }, + VolumesFrom: app.containerId ? [ app.containerId ] : null }; // older versions wanted a writable /var/log