Docker-desktop does not work on Debian

Docker Desktop can also set the default context for itself and it can also set the default socket to be used with Docker Desktop, but as far as I know, the desktop-linux context is always there. Since I mainly use macOS, I may be wrong about how a new Docker Desktop can be installed on Linux.

The fact that your file contains “desktop-linux” as context name is still strange as it is what you should see when you run docker context ls and you don’t see it. Please, run this command to get the context as json using the docker cli:

docker context ls --format json

Normally you should see the same json as you see in the file. Since docker context ls shows “default”, I expect that to be shown in the json formatted output as well.

If you get a different context from the docker cli, that could mean that your cli is using another folder. You can actually change it using an environment variable as I did that in this script:

using the DOCKER_CONFIG env variable. You can check if it is set in your shell. I would also check what you get in the outpot of this command:

which docker

And just to be sure you have no any accidentally left packages from other docker variants, you can run this command too:

dpkg -l 'docker*' | grep '^ii'
snap list docker

I don’t expect snap to be present on Debian, but the first command should also confirm that you have no other docker clients only the one from the official Docker CE repository.

I haven’t shared the command so it was not a suggestion to run it, without arguments. If you just create a new context without setting which socket you want to connect to, it will not work.

If Docker Desktop is running, this is where you should see the socket file that would be used in the desktop-linux context:

$HOME/.docker/run/docker.sock

If you run the following command in the terminal (not as root), it should set the docker host to the socket file even if your context is set to use another socket:

export DOCKER_HOST=unix://$HOME/.docker/run/docker.sock

Then if docker commands work, we at least know the client can communicate with Docker Desktop, but the required context is wrong for some reason.

If the socket file cannot be found, please run this command too:

find "$HOME/.docker" -name '*.sock'

It lists the socket files used by Docker Desktop