18
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Windows版Dockerの強制アンインストールと旧バージョンの再インストール方法

Last updated at Posted at 2017-10-03

概要

 最新版を使いたい欲に駆られてWindows版Docker v17.06.2-ceをv17.09.0-ceにアップデートしたら、恒例の再起不能状態になりましたOrz
そして、いつも通りにリセットしたりもしましたが、効果なし!!
 エラーログを見てもよくわからなかったので、意を決してダウングレードするためにDockerのアンインストールを実行したが、
アンインストール中に応答なしになり、アンインストールすることすらできませんでした・・・八方塞がり・・・
 いろいろ調べた結果として強制アンインストールする方法がありましたので、ご紹介したいと思います。
また、旧バージョンのインストーラのダウンロード方法もあわせてご紹介したいと思います。(記録用に)

強制アンインストールする方法

  1. Windows PowerShellを管理者モードで起動し、下記のコマンドを実行する

    $ErrorActionPreference = "SilentlyContinue"
    
    kill -force -processname 'Docker for Windows', com.docker.db, vpnkit, com.docker.proxy, com.docker.9pdb, moby-diag-dl, dockerd
    
    try {
        ./MobyLinux.ps1 -Destroy
    } Catch {}
    
    $service = Get-WmiObject -Class Win32_Service -Filter "Name='com.docker.service'"
    if ($service) { $service.StopService() }
    if ($service) { $service.Delete() }
    Start-Sleep -s 5
    Remove-Item -Recurse -Force "~/AppData/Local/Docker"
    Remove-Item -Recurse -Force "~/AppData/Roaming/Docker"
    if (Test-Path "C:\ProgramData\Docker") { takeown.exe /F "C:\ProgramData\Docker" /R /A /D Y }
    if (Test-Path "C:\ProgramData\Docker") { icacls "C:\ProgramData\Docker\" /T /C /grant Administrators:F }
    Remove-Item -Recurse -Force "C:\ProgramData\Docker"
    Remove-Item -Recurse -Force "C:\Program Files\Docker"
    Remove-Item -Recurse -Force "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Docker"
    Remove-Item -Force "C:\Users\Public\Desktop\Docker for Windows.lnk"
    Get-ChildItem HKLM:\software\microsoft\windows\currentversion\uninstall | % {Get-ItemProperty $_.PSPath}  | ? { $_.DisplayName -eq "Docker" } | Remove-Item -Recurse -Force
    Get-ChildItem HKLM:\software\classes\installer\products | % {Get-ItemProperty $_.pspath} | ? { $_.ProductName -eq "Docker" } | Remove-Item -Recurse -Force
    Get-Item 'HKLM:\software\Docker Inc.' | Remove-Item -Recurse -Force
    Get-ItemProperty HKCU:\software\microsoft\windows\currentversion\Run -name "Docker for Windows" | Remove-Item -Recurse -Force
    #Get-ItemProperty HKCU:\software\microsoft\windows\currentversion\UFH\SHC | ForEach-Object {Get-ItemProperty $_.PSPath} | Where-Object { $_.ToString().Contains("Docker for Windows.exe") } | Remove-Item -Recurse -Force $_.PSPath
    #Get-ItemProperty HKCU:\software\microsoft\windows\currentversion\UFH\SHC | Where-Object { $(Get-ItemPropertyValue $_) -Contains "Docker" }
    

    ※引用:https://success.docker.com/KBase/How_to_completely_remove_Docker

  2. 「プログラムの追加と削除」に「Docker for Windows」が登録されたままになっているので、CCleanerなどのツールで削除する
    ※一部のバージョンのCCleanerにマルウエアが混入している事件が発生してるので、それらを避けるか最新版を導入してください

過去のDockerインストーラのダウンロード方法

公式サイトの過去バージョンのインストーラからダウングレードする

chocolateyからダウングレードする

  1. chocolateyにアップロードされているインストールスクリプトに含まれているURLから取得する
  2. バージョン履歴から対象のバージョンを選択する
    docker-old-version.png
  3. インストールスクリプト(showをクリック)に含まれているインストーラURLからダウンロード
    package-url.png
  4. ダウンロードしたインストーラを実行する
18
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?