Docker compose error while fetching server api version

I am trying to do the docker-compose up command in my terminal. First I navigate to the file directory where I find a docker-compose.yaml. Then I write the command. The Server is on Port 80. I get ...

I am trying to do the docker-compose up command in my terminal. First I navigate to the file directory where I find a docker-compose.yaml. Then I write the command. The Server is on Port 80. I get the following error:

Traceback (most recent call last):
      File "site-packages/docker/api/client.py", line 205, in _retrieve_server_version
      File "site-packages/docker/api/daemon.py", line 181, in version
      File "site-packages/docker/utils/decorators.py", line 46, in inner
      File "site-packages/docker/api/client.py", line 228, in _get
      File "site-packages/requests/sessions.py", line 543, in get
      File "site-packages/requests/sessions.py", line 530, in request
      File "site-packages/requests/sessions.py", line 643, in send
      File "site-packages/requests/adapters.py", line 498, in send
    requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
    
    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 67, in main
      File "compose/cli/main.py", line 123, in perform_command
      File "compose/cli/command.py", line 69, in project_from_options
      File "compose/cli/command.py", line 132, in get_project
      File "compose/cli/docker_client.py", line 43, in get_client
      File "compose/cli/docker_client.py", line 170, in docker_client
      File "site-packages/docker/api/client.py", line 188, in __init__
      File "site-packages/docker/api/client.py", line 213, in _retrieve_server_version
    docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
    [12728] Failed to execute script docker-compose

The first error shows up two times then the second.

Problem:

While running a docker command like docker-compose pull, you see an error message like

Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 33, in <module>
    sys.exit(load_entry_point('docker-compose==1.27.4', 'console_scripts', 'docker-compose')())
  File "/usr/lib/python3.8/site-packages/compose/cli/main.py", line 67, in main
    command()
  File "/usr/lib/python3.8/site-packages/compose/cli/main.py", line 123, in perform_command
    project = project_from_options('.', options)
  File "/usr/lib/python3.8/site-packages/compose/cli/command.py", line 60, in project_from_options
    return get_project(
  File "/usr/lib/python3.8/site-packages/compose/cli/command.py", line 131, in get_project
    client = get_client(
  File "/usr/lib/python3.8/site-packages/compose/cli/docker_client.py", line 41, in get_client
    client = docker_client(
  File "/usr/lib/python3.8/site-packages/compose/cli/docker_client.py", line 170, in docker_client
    client = APIClient(**kwargs)
  File "/usr/lib/python3.8/site-packages/docker/api/client.py", line 197, in __init__
    self._version = self._retrieve_server_version()
  File "/usr/lib/python3.8/site-packages/docker/api/client.py", line 221, in _retrieve_server_version
    raise DockerException(
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

Solution:

This means you haven’t started your docker service!

First, try to start it using

sudo systemctl start docker

or

sudo service docker start

or

sudo /etc/init.d/docker restart

(whatever works with your distribution).

After that, retry the command that originally caused the error message to appear.

In case it still shows the same error message, try the following steps:

  • First, check /var/log/docker.log using
    cat /var/log/docker.log

    Check that file for errors during docker startup.

  • Also check if the user you’re running the command as is a member of the docker group. While insufficient permissions will not cause a FileNotFoundError(2, 'No such file or directory')), but a Permission denied, the error message might look similar in some cases.

Содержание

  1. DockerException: Error while fetching server API version #2717
  2. Comments
  3. versions
  4. [Solved] docker.errors.DockerException: Error while fetching server API version
  5. How docker.errors.DockerException: Error while fetching server API version Error Occurs ?
  6. How To Solve docker.errors.DockerException: Error while fetching server API version Error ?
  7. Solution 1: Make Sure Docker running
  8. Solution 2: Set Permission
  9. Solution 3: enable WSL Integration
  10. Summary
  11. Docker-compose fails on Windows with “Error while fetching server API version: (2, ‘CreateFile’, ‘The system cannot find the file specified.’)”
  12. Problem
  13. Reason
  14. Solution
  15. References
  16. Posts Related to «Docker-compose fails on Windows with «Error while fetching server API version: (2, ‘CreateFile’, ‘The system cannot find the file specified.’)»»:
  17. Search this site!
  18. About the site and the author
  19. Solutions are worthless unless shared!
  20. Want the latest tips directly to your inbox?
  21. Error while fetching server API version: (‘Connection aborted.’, FileNotFoundError(2, ‘No such file or directory’)) #243
  22. Comments
  23. Configuration file for jupyterhub.
  24. This is an application.
  25. create system users that don’t exist yet
  26. Let the Systemctl aware of all the environment path
  27. Application(SingletonConfigurable) configuration
  28. This is an application.

DockerException: Error while fetching server API version #2717

Could be a bug in 4.4.0 release?

versions

The text was updated successfully, but these errors were encountered:

Can you provide the output from docker version please?
Try to run this to simulate what the server version retrieval method does:

To avoid this automatic version retrieval, please set the API version to use when you instantiate the docker client.

From curl -s —unix-socket /var/run/docker.sock http://localhost/version | jq :

Having the same issue:

I’m having the same issue.

I noticed a change in the behavior of docker-py between version 4.2 and 4.3, caused by 727080b

Before this change, the client was created with an API version set to 1.35 by default. After this change, there’s no more default, and the client retrieve this version from the docker daemon. So at this points the clients needs to talk to the docker daemon.

In practice, it means that prior to this change, a user that is NOT part of the docker group could still run docker.from_env() successfully. After this change it’s not possible anymore. If user doesn’t have the permission to talk to the daemon, docker.from_env() throw this exception:

I wonder if it would be possible to get something a bit more precise than a DockerException in that case? I need to handle this case, and right now the only way is to look for `permission denied’ in the error message, or something like that. It works, but matching bits of strings in an error message is usually not the right thing to do.

Источник

[Solved] docker.errors.DockerException: Error while fetching server API version

Hello Guys, How are you all? Hope You all Are Fine. Today When I am trying to run docker-compose build I am facing following error docker.errors.DockerException: Error while fetching server API version in docker. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How docker.errors.DockerException: Error while fetching server API version Error Occurs ?

When I am trying to run docker-compose build I am facing following error.

How To Solve docker.errors.DockerException: Error while fetching server API version Error ?

  1. How To Solve docker.errors.DockerException: Error while fetching server API version Error ?

To Solve docker.errors.DockerException: Error while fetching server API version Error This Problem Usually occurs whenever docker is not running OR compose is not able to connect to docker via docker socket. Also You can check docker status with this command systemctl status docker. So that Just restart Or Start docker with this command. sudo service docker start
docker.errors.DockerException: Error while fetching server API version

To Solve docker.errors.DockerException: Error while fetching server API version Error This Problem Usually occurs whenever docker is not running OR compose is not able to connect to docker via docker socket. Also You can check docker status with this command systemctl status docker. So that Just restart Or Start docker with this command. sudo service docker start

Solution 1: Make Sure Docker running

This Problem Usually occurs whenever docker is not running OR compose is not able to connect to docker via docker socket. Also You can check docker status with this command systemctl status docker. So that Just restart Or Start docker with this command.

Solution 2: Set Permission

Just Set permission 666 for docker Just using below command.

Solution 3: enable WSL Integration

Just enable WSL Integration. Follow these step.

  1. First of all Open Docker Desktop
  2. Then Go to Settings
  3. Then Select Resources
  4. And Click on WSL Integration
  5. Make sure that your distribution is enabled
  6. Restart Docker

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Источник

Docker-compose fails on Windows with “Error while fetching server API version: (2, ‘CreateFile’, ‘The system cannot find the file specified.’)”

This post was most recently updated on June 23rd, 2022.

Once again, I come to you with a surprisingly opaque problem and offer to share my bemusingly simple solution. That should be a dedicated series on my blog – although on second thought, perhaps lobbing 90% of my articles under one tag wouldn’t be helpful… 😁

Problem

Table of Contents

When running docker-compose up the command would fail, and instead, output a disgustingly long set of what looks like a whole pile of pythons engaging in quantum entanglement, that would angrily hiss at you if bothered.

It’s not pretty. And it turns out, it’s (at least in this case) also not descriptive at all!

So the errors I got? See below:

The whole stack trace looks something like the below:

Augh. The system cannot find the file specified? API version? What is going on…

Reason

The solution – at least for me – was simple. But before delving into that, let me describe my setup so that you know whether it is applicable for you or not!

I run Docker on Windows. It is configured to run on startup and just do its thing – but occasionally it suddenly needs to gulp down over 10Gb or RAM, then proceed to do nothing, and finally requires a restart.

The OS itself is fine, it seems to recover nicely. So this time, I just killed the process, waited for a few minutes, and manually ran docker-compose from PowerShell.

That’s when the error was thrown at me. 😳

Solution

I was executing the command from my non-elevated PowerShell window. But that didn’t match how I have configured it to run on startup – instead, I needed to run docker-compose from an elevated PowerShell console.

I also realized my Docker Desktop won’t show any of my containers when run non-elevated. I guess that’s kinda obvious, right?

For you, running your stuff elevated (with admin permissions / “as an admin”) or from another user profile, if that’s how it’s configured to run normally, might work.

Stupid? Hey, if it works… 😁

References

  • Admin rights are not required for Docker on Windows anymore. It still seems to occasionally break, though. This Q on SO has some details on it: https://stackoverflow.com/questions/58663920/can-i-run-docker-desktop-on-windows-without-admin-privileges#:

Antti Koskela is a proud digital native nomadic millennial full stack developer (is that enough funny buzzwords? That’s definitely enough funny buzzwords!), who works as Solutions Architect for Precio Fishbone, building delightful Digital Workplaces.

He’s been a developer from 2004 (starting with PHP and Java), and he’s been working on .NET projects, Azure, Office 365, SharePoint and a lot of other stuff. He’s also Microsoft MVP for Office Development.

This is his personal professional (e.g. professional, but definitely personal) blog.

  • How to export the SSL/TLS certificate from a website using PowerShell? — January 10, 2023
  • 2022 Year Review – Stop Caring & Just Enjoy The Ride! — January 3, 2023
  • How to replace the default fake “ACME” certificate for Kubernetes/AKS? — December 27, 2022

Search this site!

Welcome! You just stumbled upon the home page of an all-around artisan code crafter and Microsoft MVP, Antti «koskila» Koskela.

Don’t hesitate to leave comments. I read them all and try to reply as well!

More information about me in the About -section!

Solutions are worthless unless shared!

Check out the tech & programming tips, often about ASP.NET MVC, Entity Framework, Microsoft SharePoint Server & Online, Azure, Active Directory, Office 365 or other parts of the ever-growing and more and more intimidating stack that Microsoft offers us.

I’ve been developing both classic server stuff, but also (and actually especially) more cloud-oriented stuff in the past 15 years.

There’s an occasional post about software issues other than on Microsoft’s stack, and a rare post about hardware, too! And sometimes I might post about my sessions at different community events, or experiences as an expat living in a foreign country (in 2017, that country was the USA, in 2018 & 2019 Canada).

And since I’m hosting this site on WordPress, and boy does WordPress experience a lot of issues, I might also post something about solving those cases. Like PHP compatibility issues.

Want the latest tips directly to your inbox?

Like these posts and tips? You can get them automatically right as I post them! Enter your email here or check out the RSS feed here: https://www.koskila.net/feed/

And no worries — it’s just notifications of new posts coming in, nothing else 🙂

Источник

Error while fetching server API version: (‘Connection aborted.’, FileNotFoundError(2, ‘No such file or directory’)) #243

Hi @minrk I was trying to install jupyterhub using docker container on EC2 instance but came across the following error:

[I 2018-07-12 13:25:40.772 JupyterHub app:1667] Using Authenticator: oauthenticator.github.GitHubOAuthenticator-0.7.3
[I 2018-07-12 13:25:40.772 JupyterHub app:1667] Using Spawner: dockerspawner.dockerspawner.DockerSpawner-0.9.1
[I 2018-07-12 13:25:40.776 JupyterHub app:1053] Writing cookie_secret to /srv/jupyterhub/jupyterhub_cookie_secret
[I 2018-07-12 13:25:40.798 alembic.runtime.migration migration:117] Context impl SQLiteImpl.
[I 2018-07-12 13:25:40.799 alembic.runtime.migration migration:122] Will assume non-transactional DDL.
[I 2018-07-12 13:25:40.808 alembic.runtime.migration migration:327] Running stamp_revision -> 896818069c98
[I 2018-07-12 13:25:40.884 JupyterHub proxy:431] Generating new CONFIGPROXY_AUTH_TOKEN
[I 2018-07-12 13:25:40.939 JupyterHub app:1849] Hub API listening on http://:8081/hub/
[I 2018-07-12 13:25:40.939 JupyterHub app:1851] Private Hub API connect url http://691ec25ba271:8081/hub/
[I 2018-07-12 13:25:40.941 JupyterHub proxy:554] Starting proxy @ http://:8000
13:25:41.373 — info: [ConfigProxy] Proxying https://
:8000 to (no default)
13:25:41.376 — info: [ConfigProxy] Proxy API at http://127.0.0.1:8001/api/routes
[I 2018-07-12 13:25:41.869 JupyterHub proxy:301] Checking routes
[I 2018-07-12 13:25:41.870 JupyterHub proxy:370] Adding default route for Hub: / => http://691ec25ba271:8081
13:25:41.871 — info: [ConfigProxy] 200 GET /api/routes
13:25:41.874 — info: [ConfigProxy] Adding route / -> http://691ec25ba271:8081
[I 2018-07-12 13:25:41.876 JupyterHub app:1906] JupyterHub is now running at http://:8000
13:25:41.876 — info: [ConfigProxy] 201 POST /api/routes/
[I 2018-07-12 13:25:48.916 JupyterHub log:158] 302 GET / -> /hub (@::ffff:125.21.166.181) 1.35ms
[W 2018-07-12 13:25:50.087 JupyterHub base:242] Invalid or expired cookie token
[I 2018-07-12 13:25:50.088 JupyterHub log:158] 302 GET /hub -> /hub/ (@::ffff:125.21.166.181) 0.67ms
[W 2018-07-12 13:25:53.480 JupyterHub base:242] Invalid or expired cookie token
[I 2018-07-12 13:25:53.481 JupyterHub log:158] 302 GET /hub/ -> /hub/login (@::ffff:125.21.166.181) 1.40ms
[I 2018-07-12 13:25:54.430 JupyterHub log:158] 200 GET /hub/login (@::ffff:125.21.166.181) 34.31ms
[I 2018-07-12 13:26:08.685 JupyterHub oauth2:82] OAuth redirect: ‘https://54.199.151.52:8000/hub/oauth_callback’
[I 2018-07-12 13:26:08.688 JupyterHub log:158] 302 GET /hub/oauth_login?next= -> https://github.com/login/oauth/authorize?redirect_uri=https%3A%2F%2F54.199.151.52%3A8000%2Fhub%2Foauth_callback&client_id=058666ef2ea4330db55c&response_type=code&state=[secret] (@::ffff:125.21.166.181) 2.42ms
[I 2018-07-12 13:26:19.306 JupyterHub base:499] User logged in: bhagyashreek24
[I 2018-07-12 13:26:19.308 JupyterHub log:158] 302 GET /hub/oauth_callback?code=[secret]&state=[secret] -> /user/bhagyashreek24/ (@::ffff:125.21.166.181) 1191.31ms
[I 2018-07-12 13:26:20.735 JupyterHub log:158] 302 GET /user/bhagyashreek24/ -> /hub/user/bhagyashreek24/ (@::ffff:125.21.166.181) 1.24ms
[E 2018-07-12 13:26:21.861 JupyterHub user:474] Unhandled error starting bhagyashreek24’s server: Error while fetching server API version: (‘Connection aborted.’, FileNotFoundError(2, ‘No such file or directory’))
[E 2018-07-12 13:26:21.869 JupyterHub user:483] Failed to cleanup bhagyashreek24’s server that failed to start
Traceback (most recent call last):
File «/opt/conda/lib/python3.6/site-packages/jupyterhub/user.py», line 479, in spawn
await self.stop()
File «/opt/conda/lib/python3.6/site-packages/jupyterhub/user.py», line 546, in stop
status = await spawner.poll()
File «/opt/conda/lib/python3.6/site-packages/dockerspawner/dockerspawner.py», line 421, in poll
container = yield self.get_container()
File «/opt/conda/lib/python3.6/site-packages/dockerspawner/dockerspawner.py», line 447, in get_container
‘inspect_container’, self.container_name
File «/opt/conda/lib/python3.6/concurrent/futures/_base.py», line 425, in result
return self.__get_result()
File «/opt/conda/lib/python3.6/concurrent/futures/_base.py», line 384, in __get_result
raise self._exception
File «/opt/conda/lib/python3.6/concurrent/futures/thread.py», line 56, in run
result = self.fn(*self.args, **self.kwargs)
File «/opt/conda/lib/python3.6/site-packages/dockerspawner/dockerspawner.py», line 408, in _docker
m = getattr(self.client, method)
File «/opt/conda/lib/python3.6/site-packages/dockerspawner/dockerspawner.py», line 62, in client
client = docker.APIClient(**kwargs)
File «/opt/conda/lib/python3.6/site-packages/docker/api/client.py», line 158, in init
self._version = self._retrieve_server_version()
File «/opt/conda/lib/python3.6/site-packages/docker/api/client.py», line 183, in _retrieve_server_version
‘Error while fetching server API version: <0>‘.format(e)
docker.errors.DockerException: Error while fetching server API version: (‘Connection aborted.’, FileNotFoundError(2, ‘No such file or directory’))

I have created a derivate image of dockerfile from docker hub
My dockerfile looks like this:

COPY jupyterhub_config.py /srv/jupyterhub/jupyterhub_config.py
COPY jupyterhub.key /srv/jupyterhub/jupyterhub.key
COPY jupyterhub.crt /srv/jupyterhub/jupyterhub.crt

RUN pip install oauthenticator
RUN pip install dockerspawner

CMD [«jupyterhub», «-f», «/srv/jupyterhub/jupyterhub_config.py»]

My jupyterhub_config.py file looks like this:

Configuration file for jupyterhub.

c.JupyterHub.port=8000
c.JupyterHub.authenticator_class = ‘oauthenticator.GitHubOAuthenticator’
c.GitHubOAuthenticator.oauth_callback_url = ‘https://54.199.151.52:8000/hub/oauth_callback’
c.GitHubOAuthenticator.client_id = ‘058666ef2ea4330db55c’
c.GitHubOAuthenticator.client_secret = ’93a9b6243bf7d2fd5253044f544eb12229be5276′

This is an application.

create system users that don’t exist yet

c.LocalAuthenticator.create_system_users = True
c.Authenticator.whitelist = <‘bhagyashreek24’>
c.Authenticator.admin_users = <‘bhagyashreek24’>
c.JupyterHub.ssl_cert = ‘jupyterhub.crt’
c.JupyterHub.ssl_key = ‘jupyterhub.key’
#c.JupyterHub.cookie_secret_file = ‘/srv/jupyterhub/jupyterhub_cookie_secret’
#c.JupyterHub.proxy_cmd = [‘/usr/local/bin/configurable-http-proxy’]
c.JupyterHub.hub_ip = »

Let the Systemctl aware of all the environment path

from dockerspawner import DockerSpawner
c.JupyterHub.spawner_class = ‘dockerspawner.DockerSpawner’
#DockerSpawner.container_image = ‘jupyterhub/singleuser’

Application(SingletonConfigurable) configuration

This is an application.

The text was updated successfully, but these errors were encountered:

Источник

Hello Guys, How are you all? Hope You all Are Fine. Today When I am trying to run docker-compose build I am facing following error docker.errors.DockerException: Error while fetching server API version in docker. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

Contents

  1. How docker.errors.DockerException: Error while fetching server API version Error Occurs ?
  2. How To Solve docker.errors.DockerException: Error while fetching server API version Error ?
  3. Solution 1: Make Sure Docker running
  4. Solution 2: Set Permission
  5. Solution 3: enable WSL Integration
  6. Summary

When I am trying to run docker-compose build I am facing following error.

File "/home/ming/.local/lib/python3.8/site-packages/docker/api/client.py", line 212, in _retrieve_server_version
    raise DockerException(
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

How To Solve docker.errors.DockerException: Error while fetching server API version Error ?

  1. How To Solve docker.errors.DockerException: Error while fetching server API version Error ?

    To Solve docker.errors.DockerException: Error while fetching server API version Error This Problem Usually occurs whenever docker is not running OR compose is not able to connect to docker via docker socket. Also You can check docker status with this command systemctl status docker. So that Just restart Or Start docker with this command. sudo service docker start

  2. docker.errors.DockerException: Error while fetching server API version

    To Solve docker.errors.DockerException: Error while fetching server API version Error This Problem Usually occurs whenever docker is not running OR compose is not able to connect to docker via docker socket. Also You can check docker status with this command systemctl status docker. So that Just restart Or Start docker with this command. sudo service docker start

Solution 1: Make Sure Docker running

This Problem Usually occurs whenever docker is not running OR compose is not able to connect to docker via docker socket. Also You can check docker status with this command systemctl status docker. So that Just restart Or Start docker with this command.

sudo service docker start

OR

sudo service docker restart

OR

systemctl start docker

Solution 2: Set Permission

Just Set permission 666 for docker Just using below command.

sudo chmod 666 /var/run/docker.sock

Solution 3: enable WSL Integration

Just enable WSL Integration. Follow these step.

  1. First of all Open Docker Desktop
  2. Then Go to Settings
  3. Then Select Resources
  4. And Click on WSL Integration
  5. Make sure that your distribution is enabled
  6. Restart Docker

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

  • ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly

This post was most recently updated on June 23rd, 2022.

3 min read.

Once again, I come to you with a surprisingly opaque problem and offer to share my bemusingly simple solution. That should be a dedicated series on my blog – although on second thought, perhaps lobbing 90% of my articles under one tag wouldn’t be helpful… 😁

Problem

When running docker-compose up the command would fail, and instead, output a disgustingly long set of what looks like a whole pile of pythons engaging in quantum entanglement, that would angrily hiss at you if bothered.

It’s not pretty. And it turns out, it’s (at least in this case) also not descriptive at all!

So the errors I got? See below:

Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.')

The whole stack trace looks something like the below:

Traceback (most recent call last):
   File "dockerapiclient.py", line 214, in _retrieve_server_version
   File "dockerapidaemon.py", line 181, in version
   File "dockerutilsdecorators.py", line 46, in inner
   File "dockerapiclient.py", line 237, in _get
   File "requestssessions.py", line 543, in get
   File "requestssessions.py", line 530, in request
   File "requestssessions.py", line 643, in send
   File "requestsadapters.py", line 439, in send
   File "urllib3connectionpool.py", line 670, in urlopen
   File "urllib3connectionpool.py", line 392, in _make_request
   File "httpclient.py", line 1255, in request
   File "httpclient.py", line 1301, in _send_request
   File "httpclient.py", line 1250, in endheaders
   File "httpclient.py", line 1010, in _send_output
   File "httpclient.py", line 950, in send
   File "dockertransportnpipeconn.py", line 32, in connect
   File "dockertransportnpipesocket.py", line 23, in wrapped
   File "dockertransportnpipesocket.py", line 72, in connect
   File "dockertransportnpipesocket.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 
   File "composeclimain.py", line 81, in main
   File "composeclimain.py", line 199, in perform_command
   File "composeclicommand.py", line 60, in project_from_options
   File "composeclicommand.py", line 152, in get_project
   File "composeclidocker_client.py", line 41, in get_client
   File "composeclidocker_client.py", line 170, in docker_client
   File "dockerapiclient.py", line 197, in init
   File "dockerapiclient.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.')
 [6316] Failed to execute script docker-compose

Augh. The system cannot find the file specified? API version? What is going on…

Reason

The solution – at least for me – was simple. But before delving into that, let me describe my setup so that you know whether it is applicable for you or not!

I run Docker on Windows. It is configured to run on startup and just do its thing – but occasionally it suddenly needs to gulp down over 10Gb or RAM, then proceed to do nothing, and finally requires a restart.

The OS itself is fine, it seems to recover nicely. So this time, I just killed the process, waited for a few minutes, and manually ran docker-compose from PowerShell.

That’s when the error was thrown at me. 😳

Solution

I was executing the command from my non-elevated PowerShell window. But that didn’t match how I have configured it to run on startup – instead, I needed to run docker-compose from an elevated PowerShell console.

I also realized my Docker Desktop won’t show any of my containers when run non-elevated. I guess that’s kinda obvious, right?

For you, running your stuff elevated (with admin permissions / “as an admin”) or from another user profile, if that’s how it’s configured to run normally, might work.

Stupid? Hey, if it works… 😁

References

  • Admin rights are not required for Docker on Windows anymore. It still seems to occasionally break, though. This Q on SO has some details on it: https://stackoverflow.com/questions/58663920/can-i-run-docker-desktop-on-windows-without-admin-privileges#:~:text=If%20your%20admin%20account%20is,the%20changes%20to%20take%20effect.
  • Author
  • Recent Posts

mm

Antti Koskela is a proud digital native nomadic millennial full stack developer (is that enough funny buzzwords? That’s definitely enough funny buzzwords!), who works as Solutions Architect for Precio Fishbone, building delightful Digital Workplaces.

He’s been a developer from 2004 (starting with PHP and Java), and he’s been working on .NET projects, Azure, Office 365, SharePoint and a lot of other stuff. He’s also Microsoft MVP for Office Development.

This is his personal professional (e.g. professional, but definitely personal) blog.

mm

$ curl -s --unix-socket /var/run/docker.sock  http://localhost/version | jq '.ApiVersion'
"1.41"
$ docker version
Client:
 Cloud integration: 1.0.17
 Version:           20.10.7
 API version:       1.41
 Go version:        go1.16.4
 Git commit:        f0df350
 Built:             Wed Jun  2 11:56:22 2021
 OS/Arch:           darwin/amd64
 Context:           desktop-linux
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       b0f5bc3
  Built:            Wed Jun  2 11:54:58 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.6
  GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

$ curl -s --unix-socket /var/run/docker.sock http://localhost/version | jq
{
  "Platform": {
    "Name": "Docker Engine - Community"
  },
  "Components": [
    {
      "Name": "Engine",
      "Version": "20.10.7",
      "Details": {
        "ApiVersion": "1.41",
        "Arch": "amd64",
        "BuildTime": "2021-06-02T11:54:58.000000000+00:00",
        "Experimental": "false",
        "GitCommit": "b0f5bc3",
        "GoVersion": "go1.13.15",
        "KernelVersion": "5.10.25-linuxkit",
        "MinAPIVersion": "1.12",
        "Os": "linux"
      }
    },
    {
      "Name": "containerd",
      "Version": "1.4.6",
      "Details": {
        "GitCommit": "d71fcd7d8303cbf684402823e425e9dd2e99285d"
      }
    },
    {
      "Name": "runc",
      "Version": "1.0.0-rc95",
      "Details": {
        "GitCommit": "b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7"
      }
    },
    {
      "Name": "docker-init",
      "Version": "0.19.0",
      "Details": {
        "GitCommit": "de40ad0"
      }
    }
  ],
  "Version": "20.10.7",
  "ApiVersion": "1.41",
  "MinAPIVersion": "1.12",
  "GitCommit": "b0f5bc3",
  "GoVersion": "go1.13.15",
  "Os": "linux",
  "Arch": "amd64",
  "KernelVersion": "5.10.25-linuxkit",
  "BuildTime": "2021-06-02T11:54:58.000000000+00:00"
}

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:repositorydockerwordpress>docker-compose up -d
Traceback (most recent call last):
File "dockerapiclient.py", line 214, in _retrieve_server_version
File "dockerapidaemon.py", line 181, in version
File "dockerutilsdecorators.py", line 46, in inner
File "dockerapiclient.py", line 237, in _get
File "requestssessions.py", line 543, in get
File "requestssessions.py", line 530, in request
File "requestssessions.py", line 643, in send
File "requestsadapters.py", line 439, in send
File "urllib3connectionpool.py", line 670, in urlopen
File "urllib3connectionpool.py", line 392, in _make_request
File "httpclient.py", line 1255, in request
File "httpclient.py", line 1301, in _send_request
File "httpclient.py", line 1250, in endheaders
File "httpclient.py", line 1010, in _send_output
File "httpclient.py", line 950, in send
File "dockertransportnpipeconn.py", line 32, in connect
File "dockertransportnpipesocket.py", line 23, in wrapped
File "dockertransportnpipesocket.py", line 72, in connect
File "dockertransportnpipesocket.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 "composeclimain.py", line 81, in main
File "composeclimain.py", line 200, in perform_command
File "composeclicommand.py", line 60, in project_from_options
File "composeclicommand.py", line 152, in get_project
File "composeclidocker_client.py", line 41, in get_client
File "composeclidocker_client.py", line 170, in docker_client
File "dockerapiclient.py", line 197, in __init__
File "dockerapiclient.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:repositorydockerwordpress>

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:repositorydockerwordpress>docker-compose up -d
    wordpress_db_1 is up-to-date
    wordpress_wordpress_1 is up-to-date
    
    C:repositorydockerwordpress>

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

Понравилась статья? Поделить с друзьями:
  • Docker compose error log
  • Docker build error during connect
  • Docker 404 error
  • Docker 127 error
  • Docash golf ошибка е05