diff --git a/commands/docker-compose.ts b/commands/docker-compose.ts index 438c7c035c..a24898e3a2 100644 --- a/commands/docker-compose.ts +++ b/commands/docker-compose.ts @@ -65,7 +65,11 @@ async function compose(command: string, message: string, dockerComposeFileUri?: if (selectedItem) { const terminal: vscode.Terminal = vscode.window.createTerminal('Docker Compose'); - terminal.sendText(command.toLowerCase() === 'up' ? `docker-compose -f ${selectedItem.file} ${command} -d --build` : `docker-compose -f ${selectedItem.file} ${command}`); + const configOptions: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration('docker'); + const build: string = configOptions.get('dockerComposeBuild', true) ? '--build': ''; + const detached: string = configOptions.get('dockerComposeDetached', true) ? '-d' : ''; + + terminal.sendText(command.toLowerCase() === 'up' ? `docker-compose -f ${selectedItem.file} ${command} ${detached} ${build}` : `docker-compose -f ${selectedItem.file} ${command}`); terminal.show(); if (reporter) { /* __GDPR__ diff --git a/package.json b/package.json index c652032230..694e865a19 100644 --- a/package.json +++ b/package.json @@ -434,6 +434,16 @@ "type": "boolean", "default": false, "description": "Prompt for confirmation when running System Prune command" + }, + "docker.dockerComposeBuild": { + "type": "boolean", + "default": true, + "description": "Run docker-compose with the --build argument, defaults to true" + }, + "docker.dockerComposeDetached": { + "type": "boolean", + "default": true, + "description": "Run docker-compose with the --d (detached) argument, defaults to true" } } },