Friday, June 2, 2023

Docker - err: exec: "docker-credential-desktop": executable file not found in $PATH, out: ``


Docker has revolutionized the way we package, distribute, and deploy applications. However, like any other technology, it is not immune to errors and issues. One such error that I encountered recently while working with Docker on my Mac was the "error getting credentials - executable file not found" error. In this blog post, I will share my experience with this error and provide a solution that worked for me.

The Error:

When attempting to build a Docker image or perform a Docker login, I encountered the following error message:

openjdk:17: error getting credentials - err: exec: "docker-credential-desktop": executable file not found in $PATH, out: ``

Error saving credentials: error storing credentials - err: exec: "docker-credential-desktop": executable file not found in $PATH, out: `` 


The error message suggests that the Docker daemon was unable to locate the "docker-credential-desktop" executable file in the $PATH environment variable. This executable is responsible for retrieving Docker credentials and authentication.


After researching the issue, I discovered that the problem was specific to Docker on macOS. The Docker Desktop application on macOS uses a credential helper called "docker-credential-desktop" to handle authentication with Docker registries. To resolve the error, I followed these steps:

1. Open Finder and navigate to the following path: `/Users/[USERNAME]/.docker/`.

2. Look for the file named `config.json` in the `.docker` directory.

3. Delete the `config.json` file.

4. Retry the Docker command that was previously failing (e.g., `docker build`, `docker login`, etc.).


By deleting the `config.json` file, we essentially reset the Docker configuration and remove any potential misconfigurations or conflicts. Docker Desktop will recreate the necessary files and configurations automatically when you run Docker commands again.


If you encounter the "error getting credentials - executable file not found" error while working with Docker on your macOS machine, deleting the `config.json` file located at `/Users/[USERNAME]/.docker/` can help resolve the issue. Remember to retry the Docker command after deleting the file to confirm that the error is resolved.

Docker is a powerful tool, but occasional errors and challenges are inevitable. Hopefully, this blog post has provided you with a solution to the specific error discussed here, allowing you to continue working with Docker seamlessly. Happy Dockerizing!