Install Docker Desktop on Ubuntu


Here's how to install Docker Desktop on Ubuntu.

Download the .deb file

Go to doc.docker.com and download the latest .deb package.

There are some instructions there on what to do:

sudo apt update
sudo apt install ./docker-desktop-4.22.1-amd64.deb

Broken packages problem on install

For me, I had a problem when I tried to install this:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'docker-desktop' instead of './docker-desktop-4.22.0-amd64.deb'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 docker-desktop : Depends: docker-ce-cli but it is not installable
E: Unable to correct problems, you have held broken packages.

Broken packages, eh? I tried many things to try and fix this. None seemed to work.

Then I found a set of stackoverflow instructions. It said:

The issue you are facing is due to the missing Docker repository on your system

And directed me to the Docker Engine docs (which, as of this writing, are a little different than what's in the SO post):

# allow apt over https
sudo apt update
sudo apt install -y ca-certificates curl gnupg

# add docker gpg key
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# setup up the docker repository
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# one more time
sudo apt update

Once I resolved that, I could install docker desktop successfully:

sudo apt install ./docker-desktop-4.22.0-amd64.deb

And test it:

docker version

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Client: Docker Engine - Community
 Cloud integration: v1.0.35-desktop+001
 Version:           24.0.5
 API version:       1.43
 Go version:        go1.20.6
 Git commit:        ced0996
 Built:             Fri Jul 21 20:35:18 2023
 OS/Arch:           linux/amd64
 Context:           default

Works. No engine. Just desktop. Commands upon commands.

Start Docker Desktop

To get it started, run:

systemctl --user start docker-desktop

The first time you run it, you won't be authenticated. To set up a user, you'll have to initialize pass, which is what docker stores its credentials in.

Generate a gpg key:

gpg --generate-key

Copy the public key into this command, and run it:

pass init [your_public_gpg_key]

Then in the docker desktop UI, you should be able to authenticate with this new user, as specified by the email in your gpg key.