From c05d16f050e1608b8f729928beba7588d56b2949 Mon Sep 17 00:00:00 2001 From: Thomas Darimont Date: Fri, 22 Jul 2016 23:35:06 +0200 Subject: [PATCH] Honor MACHINE_STORAGE_PATH environment for virtualBoxLogs Previously vbox log files were only stored beneath the .docker folder relative to the user's home-directory which potentially resulted in filenotfound errors. We now store the vbox log files relative to the MACHINE_STORAGE_PATH for docker machines, e.g. on windows with `MACHINE_STORAGE_PATH` set to `C:\dev\docker\machine` the logs for the `default` vm would be written to `C:\dev\docker\machine\machines\default\default\Logs\VBox.log` Signed-off-by: Thomas Darimont --- src/utils/DockerMachineUtil.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/utils/DockerMachineUtil.js b/src/utils/DockerMachineUtil.js index 049f8b9bd8..4ae6969dd8 100644 --- a/src/utils/DockerMachineUtil.js +++ b/src/utils/DockerMachineUtil.js @@ -177,7 +177,14 @@ var DockerMachine = { } }, virtualBoxLogs: function (machineName = this.name()) { - let logsPath = path.join(util.home(), '.docker', 'machine', 'machines', machineName, machineName, 'Logs', 'VBox.log'); + + var logsPath = null; + if (process.env.MACHINE_STORAGE_PATH) { + logsPath = path.join(process.env.MACHINE_STORAGE_PATH, 'machines', machineName, machineName, 'Logs', 'VBox.log'); + } else { + logsPath = path.join(util.home(), '.docker', 'machine', 'machines', machineName, machineName, 'Logs', 'VBox.log'); + } + let logData = null; try { logData = fs.readFileSync(logsPath, 'utf8');