Since some time apt-key is deprecated and lot of Ubuntu 22.04 based systems throws the following warning:

1
Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details

You can easily fix this by properly installing Docker and Kubernetes apt archives public keys:

1
2
3
4
5
6
7
wget -qO - https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor | sudo dd of=/usr/share/keyrings/docker-archive-keyring.gpg

echo 'deb [ arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg ] https://download.docker.com/linux/ubuntu jammy stable' | sudo tee /etc/apt/sources.list.d/docker.list

wget -qO - https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor | sudo dd of=/usr/share/keyrings/kubernetes-archive-keyring.gpg

echo 'deb [ arch=amd64 signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg ] http://apt.kubernetes.io/ kubernetes-xenial main' | sudo tee /etc/apt/sources.list.d/kubernetes.list

Take a look at /etc/apt/sources.list.d and find out if there is also an old source definition and if you find it, just delete it, the new one will suffice. You can also find out if there are duplicates if you run sudo apt-get update. Just delete the old version which doesn’t contain signed-by inside.

If this is a fresh installation, you can continue with the following commands:

1
2
3
4
sudo apt-get update
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo apt-get install kubectl

This will install the newest versions of Docker and kubectl on your desktop. If you take a careful look, it will also install the buildx plugin for Docker which greatly speeds up the builds. If you want to permanently active buildx, just run this command export DOCKER_BUILDKIT=1 and if you want the old way of seeing the build progress, you can also do export BUILDKIT_PROGRESS=plain.

However, if you already had these two installed, you just have to do the upgrade:

1
2
sudo apt-get update
sudo apt-get upgrade