How to Solve Error Message docker.errors.DockerException: Error while fetching server API version: (2, ‘CreateFile’, ‘The system cannot find the file specified.’) when running docker-compose

Posted on

Introduction

Another article where the focus is to focus on how to solve a specific error. That specific error message appear when the execution of a ‘docker-compose’ command. Furthermore, the execution of the ‘docker-compose’ in this case is in Microsoft Windows. The following is the actual execution of that ‘docker-compose’ command :

C:\repository\docker\wordpress>docker-compose up -d
Traceback (most recent call last):
File "docker\api\client.py", line 214, in _retrieve_server_version
File "docker\api\daemon.py", line 181, in version
File "docker\utils\decorators.py", line 46, in inner
File "docker\api\client.py", line 237, in _get
File "requests\sessions.py", line 543, in get
File "requests\sessions.py", line 530, in request
File "requests\sessions.py", line 643, in send
File "requests\adapters.py", line 439, in send
File "urllib3\connectionpool.py", line 670, in urlopen
File "urllib3\connectionpool.py", line 392, in _make_request
File "http\client.py", line 1255, in request
File "http\client.py", line 1301, in _send_request
File "http\client.py", line 1250, in endheaders
File "http\client.py", line 1010, in _send_output
File "http\client.py", line 950, in send
File "docker\transport\npipeconn.py", line 32, in connect
File "docker\transport\npipesocket.py", line 23, in wrapped
File "docker\transport\npipesocket.py", line 72, in connect
File "docker\transport\npipesocket.py", line 52, in connect
pywintypes.error: (2, 'CreateFile', 'The system cannot find the file specified.')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose\cli\main.py", line 81, in main
File "compose\cli\main.py", line 200, in perform_command
File "compose\cli\command.py", line 60, in project_from_options
File "compose\cli\command.py", line 152, in get_project
File "compose\cli\docker_client.py", line 41, in get_client
File "compose\cli\docker_client.py", line 170, in docker_client
File "docker\api\client.py", line 197, in __init__
File "docker\api\client.py", line 221, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.')
[32608] Failed to execute script docker-compose

C:\repository\docker\wordpress>

How to Solve Error Message

So, the error message’s solution is available in other article. This is the reference exist in this link in order to solve it. In that article, there are several solutions for solving it. In this article, the following is the actual steps in order to handle the error message :

  1. First of all, it is because the Docker service is not running. In this case, the running process for the Docker service is going to be handle by executing the Docker Desktop application. So, the first solution is just by executing the Docker Desktop application. In the example in this article, it is using a Windows 11. So, the following is the appearance of searching Docker Desktop application for further execution :

    How to Solve Error Message docker.errors.DockerException: Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.') when running docker-compose
    How to Solve Error Message docker.errors.DockerException: Error while fetching server API version: (2, ‘CreateFile’, ‘The system cannot find the file specified.’) when running docker-compose
  2. The second one, just run the Docker Desktop application as it exist in the following image :

    whereHow to Solve Error Message docker.errors.DockerException: Error while fetching server API version: (2, ‘CreateFile’, ‘The system cannot find the file specified.’) when running docker-compose

  3. Next step, just make sure that the Docker Desktop application is up and running after execute it in the first step. The following is the appearance of the Docker Desktop which is currently running where it shows the container list :

    How to Solve Error Message docker.errors.DockerException: Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.') when running docker-compose
    How to Solve Error Message docker.errors.DockerException: Error while fetching server API version: (2, ‘CreateFile’, ‘The system cannot find the file specified.’) when running docker-compose
  4. After running the Docker Desktop Application properly, just check back by executing the previous command :

    C:\repository\docker\wordpress>docker-compose up -d
    wordpress_db_1 is up-to-date
    wordpress_wordpress_1 is up-to-date
    
    C:\repository\docker\wordpress>

    Apparently, the error appear just because the Docker Desktop Application or Docker Desktop Service is not running.

Leave a Reply