Skip to content

Instantly share code, notes, and snippets.

@manjufy
Created October 4, 2024 13:45
Show Gist options
  • Save manjufy/c9e742bff6e08eb8f3b56a6c49435644 to your computer and use it in GitHub Desktop.
Save manjufy/c9e742bff6e08eb8f3b56a6c49435644 to your computer and use it in GitHub Desktop.
Docker desktop issue in Fedora 40

Docker issue in Fedora

If you bump into running Docker engine in Fedora, remember to uninstall Docker Desktop as it conflicts with docker service.

Error

Cannot connect to the Docker daemon at unix:///home/{username}/.docker/desktop/docker.sock

The error "Cannot connect to the Docker daemon at unix:///home/{username}/.docker/desktop/docker.sock" typically indicates that Docker is trying to use an incorrect or non-standard socket path (/home/xxx/.docker/desktop/docker.sock), instead of the default path (/var/run/docker.sock). This is especially common if Docker Desktop for Linux was attempted but is not supported on Fedora or if there's a misconfiguration in Docker’s settings.

Step-by-Step Solution:

  1. Check if Docker is Running

Ensure that Docker is running and using the correct socket. Start by checking the status of the Docker service:

sudo systemctl status docker

If Docker is not running, start it with:

sudo systemctl start docker
  1. Set the Correct Docker Socket Path

It looks like Docker is trying to use the wrong socket path (/home/{manju}/.docker/desktop/docker.sock). The default Docker socket is located at /var/run/docker.sock.

You can correct this by setting the Docker host to the correct socket location. Option A: Set the DOCKER_HOST Environment Variable

Temporarily set the DOCKER_HOST environment variable to the correct socket:
export DOCKER_HOST=unix:///var/run/docker.sock

Check if Docker now works:

docker ps

If this works, it indicates that Docker was using the wrong socket.

To make this change permanent, add the environment variable to your shell configuration file:

For bash, add this line to ~/.bashrc:
echo 'export DOCKER_HOST=unix:///var/run/docker.sock' >> ~/.bashrc
source ~/.bashrc

For zsh, add this line to ~/.zshrc:

echo 'export DOCKER_HOST=unix:///var/run/docker.sock' >> ~/.zshrc
source ~/.zshrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment