Skip to content

Commit

Permalink
add param to start the service, fixes #12
Browse files Browse the repository at this point in the history
  • Loading branch information
AJDurant committed Nov 15, 2023
1 parent b91a041 commit 5046ef1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions docker-engine.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ The following package parameters can be set:

* `/DockerGroup:` - Name of the user group for using docker - defaults to "docker-users"
* `/noAddGroupUser` - Prevent adding the current user to the DockerGroup
* `/StartService` - Automatically start (or restart) the docker service after install (or upgrade)

To pass parameters, use `--params "''"` (e.g. `choco install docker-engine [other options] --params="'/DockerGroup:my-docker-group /noAddGroupUser'"`).
To have choco remember parameters on upgrade, be sure to set `choco feature enable -n=useRememberedArgumentsForUpgrades`.
Expand Down
9 changes: 8 additions & 1 deletion tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,12 @@ If (Test-OurOldDockerd) {
If (-not (Test-OurDockerd)) {
$scArgs = "create docker binpath= `"$dockerdPath --run-service`" start= auto displayname= `"$($env:ChocolateyPackageTitle)`""
Start-ChocolateyProcessAsAdmin -Statements "$scArgs" "C:\Windows\System32\sc.exe"
Write-Host "$($env:ChocolateyPackageTitle) service created, start with: `sc start docker` "

If (!$pp.StartService) {
Write-Host "$($env:ChocolateyPackageTitle) service created, start with: `sc start docker` "
}
Else {
Write-output "Starting docker service..."
Start-ChocolateyProcessAsAdmin -Statements "start docker" "C:\Windows\System32\sc.exe"
}
}

0 comments on commit 5046ef1

Please sign in to comment.