Skip to content

Instantly share code, notes, and snippets.

@mikey-t
Created August 31, 2022 19:31
Show Gist options
  • Save mikey-t/ee20254ebd1b8085758f362059154efd to your computer and use it in GitHub Desktop.
Save mikey-t/ee20254ebd1b8085758f362059154efd to your computer and use it in GitHub Desktop.
Auto start docker in wsl if it's not running. This is using @mikeyt23/node-cli-utils for waitForProcess/defaultSpawnOptions and assumes you'll use this task in a gulp series or parallel call.
async function startDockerIfNotRunning() {
const args = [
'-u',
'root',
'-e',
'sh',
'-c',
'"service docker status || service docker start"'
]
await waitForProcess(spawn('wsl', args, defaultSpawnOptions))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment