Recovering from conflicting Docker Compose versions

I have had docker/docker-compose installed on Ubuntu from an age ago.

I had trouble running a newer docker image, and there was suggestion to upgrade docker-compose.

I have no recollection of how I installed docker/docker-compose – it was not listed in apt. And so I had no idea how to update it.

So rushed ahead and installed Docker Desktop, hoping it would replace the original versions. I believe I now have my system in a bit of state, where my images stall.

This is what I get for the vesions:

$ docker compose version
Docker Compose version v2.29.1-desktop.1

$ docker --version
Docker version 27.1.2, build d01f264

$ docker-compose --version
docker-compose version 1.29.1, build c34c88b2

When I start Docker Desktop from the Ubuntu menu, it errors – I don’t know how to get the error message. If I run systemctl --user start docker-desktop I get no output. sudo service docker status reports its is “active”.

If I run docker version, it hangs but when I ctrl-c it then spits out…

^CClient: Docker Engine - Community
 Version:           27.1.2
 API version:       1.46
 Go version:        go1.21.13
 Git commit:        d01f264
 Built:             Mon Aug 12 11:50:54 2024
 OS/Arch:           linux/amd64
 Context:           desktop-linux

I would normally run this command to start my container:

docker-compose --file docker-compose.yaml up -d --build

This errors. If I try with docker compose it hangs.

If I run docker image ls it also hangs.

There are so many details here I’m unsure where to start looking for a problem (I am far from fluent with docker.)

With a fresher mind, I have re-attempted a clean install. The docker command still hangs, but this what have done to remove any potential conflict between an old docker verson and Docker Desktop.

  1. Uninstalled Docker Desktop.

  2. I have ran the following command to remove any old versions, as per https://docs.docker.com/engine/install/ubuntu/#uninstall-docker-engine

    for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
    
  3. I have ran the following commands to remove docker engine and all images/containers, as per https://docs.docker.com/engine/install/ubuntu/#uninstall-docker-engine

    sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
    sudo rm -rf /var/lib/docker
    
  4. The /usr/local/bin/docker-compose file still existed and was removed as per https://stackoverflow.com/a/31143355/2045006

    sudo rm /usr/local/bin/docker-compose
    
  5. I then re-installed Docker Desktop and launched it from the command line (rather than from Ubuntu menus) as per https://docs.docker.com/desktop/install/ubuntu/#install-docker-desktop

    sudo apt-get update
    sudo apt-get install ./docker-desktop-amd64.deb
    systemctl --user start docker-desktop
    

With all this done, docker compose version and docker --version report the correct versions (as it did previously). But docker version and docker image ls hangs. When I ctrl-c the latter, I get the following output.

^[[1;2C^CGet "http://%2Fhome%2Fcourtney%2F.docker%2Fdesktop%2Fdocker.sock/_ping": context canceled

I no longer believe the issue relates to a conflicting docker installs, and have raised a separate topic for the more explicit problem – All docker commands hang: Proxy error handling "/_ping"