Docker snap keeps reinstalling itself automatically after removal

Hello,

I’m experiencing a persistent issue where the Docker snap package automatically reinstalls itself on my Ubuntu 24.04 system, despite being completely removed using snap remove docker --purge.

System Information:

  • OS: Ubuntu 24.04 (Noble)
  • Snapd version: 2.71

Issue Details:

  1. I have Docker CE installed via APT (official Docker repository)
  2. I don’t need the Docker snap and have removed it multiple times using snap remove docker --purge
  3. The Docker snap keeps reappearing automatically after a few days
  4. This happens without any manual intervention from my side

What I’ve checked:

  • No other snaps depend on Docker (checked with snap connections)
  • No cron jobs or systemd timers are installing it
  • No VS Code extensions or development tools seem to trigger this
  • The snap refresh logs show it’s being installed, but don’t indicate the source

Questions:

  1. Is there a known mechanism in snapd that could automatically reinstall previously removed snaps?
  2. Could having Docker CE installed via APT trigger some compatibility mechanism that installs the snap version?
  3. Is there a way to permanently blacklist/block a specific snap from being installed?
  4. Are there any hidden configuration files or caches that might retain “memory” of previously installed snaps?

I’ve created a monitoring script to detect when this happens, and it consistently shows the Docker snap reappearing every few weeks (~3-4). Any insights into what might be causing this behaviour would be greatly appreciated.

Thank you for your help!

2 Likes

There is definitely nothing in snapd that would do this, a snap that is gone is gone for good unless something else calls snap install ... for it …

1 Like

I’ve also had the docker snap installed without manual intervention on my part twice. The second time was just a few days ago (I can’t be more specific as I haven’t used Docker for a few days).

❯ snap --version
snap    2.71
snapd   2.71
series  16
ubuntu  24.04
kernel  6.8.0-84-generic

With both the snap package and the apt package installed, there are multiple docker environments installed, and with every systemd Docker service reboot, it’s random which one will be available through the CLI.

2 Likes

I agree with you. Nevertheless, it happens and it’s very annoying. I know several coworkers who have the same issue. How could package installation be logged?

You can surely check snap changes to see the install process logs … but this must be triggered from outside the snap system itself (some script or whatnot) that calls snap install docker

have you checked your journal for the time-frame when these things happen ?

Am also having this issue; latest was today. Ubuntu 22.04

1 Like

Yes, I haven’t found anything yet

well, and snap changes ?

Unfortunately, history is too short. I’ll look at it the next time the Docker snap will be installed.

1 Like

you could set up an hourly cron job to run: snap list | grep docker && snap changes > /tmp/changes.log

1 Like

noticed it had happened to me again today; will double-check next time i run a snap refresh, because it was fine beforehand, and i’m pretty sure the snap core was the only thing that got picked up last time

I too have the exact same problem and can confirm everything OP has said. Despite using purge every time to remove it, it keeps coming back. It happens pretty much every month or so at least once. I have no other obvious software that would have the permission to do so. It must also have the permissions to shutdown the currently running daemon so it is definitely coming from an elevated process.

So, I’m not sure what your system is here, but I finally found the culprit on mine: snap “storage-explorer” from msft-storage-tools will try to grab docker when you update it, but does not list it under the “connections” area from what I can see.

Hope it helps.

5 Likes

From the snap config:

apps:
  storage-explorer:
    command: StorageExplorerSnap
    plugs:
    - desktop
    - desktop-legacy
    - gsettings
    - opengl
    - wayland
    - x11
    - browser-support
    - docker
    - docker-executables
    - home
    - mount-observe
    - network
    - password-manager-service
    - pulseaudio
    - removable-media
    - unity7
    environment:
      PATH: $SNAP/docker-snap/bin:$PATH
      TMPDIR: $XDG_RUNTIME_DIR
      DISABLE_WAYLAND: '1'
      DOTNET_ROOT: $SNAP/usr/share/dotnet
    command-chain:
    - snap/command-chain/desktop-launch
plugs:
  docker:
    interface: docker
  docker-executables:
    content: docker-executables
    interface: content
    target: $SNAP/docker-snap
    default-provider: docker

The content interface will pull in snaps that have a default-provider.

Ref: https://snapcraft.io/docs/content-interface#heading--default

Cheers, Just

4 Likes

My coworkers and me are all using Azure Storage Explorer package. Thank you @jmacnett :clap:

I’m closing this thread. Now we’ve to discuss this with Microsoft devs :arrow_right: https://github.com/microsoft/AzureStorageExplorer/issues/8580

1 Like