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.
- 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
- 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