microsoft/Windows-Containers

How to Upgrade DockerCE / Moby

visch opened this issue · 1 comments

What is your question?

Asking this question here to help out my future self and others as there's not clear documentation I can find for how to do this.

Steps for original install was

  1. Follow https://learn.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=dockerce#install-the-container-runtime

Now the containers have been running in production for over a year and I'd like to upgrade the container runtime, it's not clear how to do this. I'm going to try re-running the powershell script and we'll see if that works!

1st try (Not successful)

  1. Uninstalled the Windows Feature "Containers"
  2. Restarted Machine
  3. Ran Script from https://learn.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=dockerce#install-the-container-runtime
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/Windows-Containers/Main/helpful_tools/Install-DockerCE/install-docker-ce.ps1" -o install-docker-ce.ps1
.\install-docker-ce.ps1
  1. This restarted the machine again
  2. Ran docker --version and we're still on the old version of Docker

Try2 (Seemingly successful will report back if something fails)

  1. Dove through powershell script
  2. Found that only 2 files are really being used and dumped into System32 (docker.exe and dockerd.exe)
  3. Download latest files from https://download.docker.com/win/static/stable/x86_64/
  4. Turn off "Docker Engine" Service
  5. Manually copy both docker.exe and dockerd.exe to C:\Windows\System32
  6. Turn on Docker Engine Service

Done

Hey @visch, great point this could be documented more. Uninstalling the containers or Hyper-V feature is not necessary since these should be automatically upgraded with Windows update. The only thing that needs to change are the docker binaries.

Right now the logic of the install script just checks for the presence of docker on the machine, but we could update it to check both presence and version and then ask the user if they want to upgrade to a newer version. Also an upgrade flag could be useful.

What I'd recommend right now, is to uninstall the docker binaries and then run the install script again. We have a PR for adding an uninstall script if you want to try testing that out: #435

Once you uninstall and then reinstall, you should get the latest version of docker. I have logic in there to check for the latest version and it has so far seemed to work, but if you notice issues please let us know here!