4

ERROR: After running a command Docker-compose up It throwing such type of error

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.')
[10776] Failed to execute script docker-compose

Here is the Dockerfile:

FROM python:3.7.4
ENV PYTHONBUFFERED 1
WORKDIR /app
COPY requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt
COPY . /app
CMD python manage.py runserver 0.0.0.0:8000

docker-compose.yml file:

version: '3.9'
services:
  backend:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - 8000:8000
    volumes:
      - .:/app

Can somebody help to solve this error. Actually I'm trying to solve this error from last 3 hours but still I din't found any solution & for this I'm using docker-compose version 1.29.2 & below is the requirement.txt if you need to solve this error.

asgiref==3.3.4
Django==3.2.3
django-cors-headers==3.11.0
djangorestframework==3.13.1
importlib-metadata==4.10.0
numpy==1.20.3
pandas==1.2.4
pika==1.2.0
psycopg2==2.8.6
python-dateutil==2.8.1
pytz==2021.1
six==1.16.0
sqlparse==0.4.1
typing-extensions==3.10.0.0
zipp==3.7.0
3
  • 1
    Your docker-compose is very old. The current version is 2.2.3. Commented Jan 13, 2022 at 14:10
  • 2
    Is the Docker daemon actually running; can you run docker info successfully (its output isn't interesting, it just needs to not return an error)? Commented Jan 13, 2022 at 14:11
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Jan 22, 2022 at 11:41

1 Answer 1

1

Docker Compose needs privilege access, make sure to provide the one before running the docker-compose command otherwise you get the Traceback as you mentioned.

You may need to kill the current Docker process and restart the Docker Desktop, then it works most likely.

P.S. I am on MacOS and getting the same error as above after restarting and providing the root access to Docker Desktop (version 4.10.1) application I am able to run the docker-compose command successfully.

docker-compose up -d --build
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.