Tuesday, March 16, 2021

Prevent Docker for Windows Auto Update

I recently installed Docker Desktop in order to then install PiHole on my Windows 10 desktop PC. PiHole is a cool and free little utility that you can install as a Docker container to provide ad blocking capability that goes a step further than a browser ad blocker add-on like say UBlock Origin. Once installed you can have your PC serve as a sort of DNS proxy for your entire network which bypasses a wide array of blacklisted IP addresses and domains.

One annoying and frankly impolite "feature" of Docker Desktop in general is that some time ago (possibly after version 2.5 or thereabouts) they removed an option through the GUI to disable automatic updates. This is irritating because what you might expect happened to me; a newer, buggy version once installed caused Docker to behave erratically and crash frequently. 

I took a quick look at the Docker documentation (Dockermentation??) and while there are command line options to disable auto updates in the Docker daemon I haven't got the patience to figure out what syntax to use; I mean come on, I'm so lazy I'm using Windows 10, right?

Instead I tried to find out where Docker downloads its updated versions, and I believe I found that folder as shown below. From the Start menu you can type in C:\Users\<Windows username>\AppData\Local\Docker Desktop Installer:



Docker's systray icon will conspicuously show a little "i" to inform you of a looming upgrade, and at the next restart of Docker Desktop the upgrade ordinarily will be installed. However, in lazily taking a stab at preventing this behavior I decided to alter the file system attributes of the folder containing the updates to make it and its contents read-only.

The idea is to both prevent updates from being downloaded in the first place, and in case Docker normally attempts to write any temp files to that folder as part of the upgrade process to kneecap its ability to do so and maybe indicate to that logic something's up that makes upgrading a bad idea.



I altered the folder attributes and applied them, then exited Docker via the systray icon and after a minute or so opened the shortcut. I checked the version first of all:



I was rewarded not with Docker dictating the 3.2.x version I'd use going forward, but rather the previous 3.1.x version I downgraded to in order to not get stuck with the buggy behavior of the newer but less stable version. Success!



I also noticed the conspicuous "i" was gone, as if the logic quietly decided the attempt to upgrade never even happened, which is fine by me.

Of course this isn't the optimal way to prevent software from doing its thing despite user preference, but in these "challenging" times laziness reigns supreme in my headspace. Possible caveats may be that the next time you manually upgrade to a newer version you might need to reapply this change to your file system (too lazy to post a batch file to do it, sorry!) but that's minor compared to browsing on my tablet across the house from my PC and having Docker crash and take out my PiHole.