Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider if the installed version is not matching the parametrized version #467

Open
wants to merge 2 commits into
base: Main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion helpful_tools/Install-DockerCE/install-docker-ce.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,35 @@ Install-ContainerHost
}
}

#
# Install, register, and start Docker
#
if (Test-Docker-Version)
{
Write-Output "Docker is already installed with specific version."
}
else
{
if (Test-Docker)
{
#Stop all containers
docker stop $(docker ps -aq)

#Halt the docker service
Stop-Service -Name docker

#Unregister the docker service
dockerd --unregister-service
}
if ($NATSubnet)
{
Install-Docker -DockerPath $DockerPath -DockerDPath $DockerDPath -NATSubnet $NATSubnet -ContainerBaseImage $ContainerBaseImage
}
else
{
Install-Docker -DockerPath $DockerPath -DockerDPath $DockerDPath -ContainerBaseImage $ContainerBaseImage
}
}
if ($TarPath)
{
cmd /c "docker load -i `"$TarPath`""
Expand Down Expand Up @@ -729,6 +758,16 @@ Test-Docker()
}


function
Test-Docker-Version()
{
$version = & docker version --format "{{.Server.Version}}"
Write-Host "Installed version:" $version
Write-Host "Target version:" $DockerVersion
return ($version -eq $DockerVersion)
}


function
Wait-Docker()
{
Expand Down Expand Up @@ -772,4 +811,5 @@ try
catch
{
Write-Error $_
}
}