最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Failed to execute script docker-compose YML file in Windows 10 - Stack Overflow

programmeradmin5浏览0评论

I'm using windows 10 and docker toolbox and as I try docker pose up --build option, I get the following errors:

pywintypes.error: (2, 'CreateFile', 'The system cannot find the file specified.')

docker.errors.DockerException: Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.') [8628] Failed to execute script docker-pose

The full extract is as follows:

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-pose", line 3, in <module>
  File "pose\cli\main.py", line 80, in main
  File "pose\cli\main.py", line 189, in perform_mand
  File "pose\cli\mand.py", line 60, in project_from_options
  File "pose\cli\mand.py", line 152, in get_project
  File "pose\cli\docker_client.py", line 41, in get_client
  File "pose\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.')
[8628] Failed to execute script docker-pose

Docker Compose YML File is below:

services:
  frontend:
    build: frontend
    depends_on:
      - api
    tty: true
    volumes:
      - ./frontend/public:/frontend/public:cached,ro
      - ./frontend/src:/frontend/src:cached,ro
    ports:
      - "3000:3000"

  api:
    build: backend
    depends_on:
      - database
    tty: true
    volumes:
      - ./backend/bin:/backend/bin:cached,ro
      - ./backend/src:/backend/src:cached,ro
    ports:
      - "3001:3001"
    environment:
      DATABASE_USER: "root"
      DATABASE_PASSWORD: "1234"

  database:
    image: mongo:4.4
    ports:
      - "27017:27017"
    environment:
      MONGO_INITDB_ROOT_USERNAME: "root"
      MONGO_INITDB_ROOT_PASSWORD: "1234"

I am not sure what causes this problem, as I am new to docker. Please give your suggestions, Thanks.

I'm using windows 10 and docker toolbox and as I try docker pose up --build option, I get the following errors:

pywintypes.error: (2, 'CreateFile', 'The system cannot find the file specified.')

docker.errors.DockerException: Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.') [8628] Failed to execute script docker-pose

The full extract is as follows:

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-pose", line 3, in <module>
  File "pose\cli\main.py", line 80, in main
  File "pose\cli\main.py", line 189, in perform_mand
  File "pose\cli\mand.py", line 60, in project_from_options
  File "pose\cli\mand.py", line 152, in get_project
  File "pose\cli\docker_client.py", line 41, in get_client
  File "pose\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.')
[8628] Failed to execute script docker-pose

Docker Compose YML File is below:

services:
  frontend:
    build: frontend
    depends_on:
      - api
    tty: true
    volumes:
      - ./frontend/public:/frontend/public:cached,ro
      - ./frontend/src:/frontend/src:cached,ro
    ports:
      - "3000:3000"

  api:
    build: backend
    depends_on:
      - database
    tty: true
    volumes:
      - ./backend/bin:/backend/bin:cached,ro
      - ./backend/src:/backend/src:cached,ro
    ports:
      - "3001:3001"
    environment:
      DATABASE_USER: "root"
      DATABASE_PASSWORD: "1234"

  database:
    image: mongo:4.4
    ports:
      - "27017:27017"
    environment:
      MONGO_INITDB_ROOT_USERNAME: "root"
      MONGO_INITDB_ROOT_PASSWORD: "1234"

I am not sure what causes this problem, as I am new to docker. Please give your suggestions, Thanks.

Share Improve this question edited Apr 1, 2021 at 19:20 verdier 645 bronze badges asked Apr 1, 2021 at 9:37 Humair AliHumair Ali 711 silver badge9 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

Verify that Docker is started and try again

It seems the error you're facing is due to the path specified in the volumes on your docker-poser:

volumes:
  - ./frontend/public:/frontend/public:cached,ro
  - ./frontend/src:/frontend/src:cached,ro

You're basically telling the docker to mount a volume that doesn't exist as you're using Linux path structure on Windows 10.

Remember that on Windows / is equal to \. Otherwise, it would be best if you try to use absolute paths, to better find the issue.

You can find more information about windows paths on this link and in this other link you can find more information about volumes in docker-poser.

发布评论

评论列表(0)

  1. 暂无评论