Sometimes the latest version of software may include bugs that have not been fixed.This is the case for docker on Ubuntu 22.04. The buildkit version prints on stderr instead of stdout and this causes some issues on teamcity. As a solution I wanted to downgrade docker on a previous version. First you will need to delete the existing docker installation. You can do this with the below commands:
sudo apt-get purge -y docker-engine docker docker.io docker-ce docker-ce-cli docker-compose-plugin sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce docker-compose-plugin sudo rm -rf /var/lib/docker /etc/docker sudo rm /etc/apparmor.d/docker sudo groupdel docker sudo rm -rf /var/run/docker.sock
Based on your OS version you can go under docker downloads and find a specific version. Some older docker version exist for older OS versions but you can install them on later versions also.
Index of linux/ubuntu/dists/ (docker.com)
There could be a case when you have jammy (22.04) but you want to install binaries that were available on bionic version (18.04). In order to install an older version of docker you will need to download the old binaries by navigating inside the specific version then selecting pool and finally stable. Inside the last folder you can find all the architectures that are supported and you should select the appropriate one. For x64 you can select amd64 and then you can find a specific version of the binary.
In order to install specific version you will need to download all the packages that you need (some of them are dependencies of docker-ce) with wget and then install them.
Download:
wget https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/docker-scan-plugin_0.17.0~ubuntu-bionic_amd64.deb
Install:
dpkg -i docker-scan-plugin_0.17.0~ubuntu-bionic_amd64.deb




Its not neccesary to delete your containers with “sudo rm -rf /var/lib/docker /etc/docker”.
Just stop systemctl process from running docker
sudo systemctl stop docker
sudo systemctl stop docker.socket
Uninstall docker
sudo apt remove docker-ce docker-ce-cli docker-buildx-plugin docker-compose-plugin
Find the applicable version from your apt cache
apt-cache madison docker-ce
Re-Install
sudo apt install docker-ce=5:28.5.1~ubuntu.22.04~jammy
Docker should now start again, if not run
sudo systemctl start docker
No need to remove your containers and all files
This is the command that deletes your containers and etc
sudo rm -rf /var/lib/docker /etc/docker
Instead just stop docker
sudo systemctl stop docker
sudo systemctl stop docker.socket
Uninstall the current version
sudo apt remove docker-ce docker-ce-cli docker-buildx-plugin docker-compose-plugin
Find a version that works for you:
apt-cache madison docker-ce
sudo apt install docker-ce=5:28.5.1~ubuntu.22.04~jammy
Docker should now be coming online, if not run
sudo systemctl start docker