why docker raises 'chunked'Error while fetching server API version: HTTPConnection.request() got an unexpected keyword argument 'chunked'?
Asked Answered
H

2

4

I have been trying to build a docker service which would run django. but keep getting

docker.errors.DockerException: Error while fetching server API version: HTTPConnection.request() got an unexpected keyword argument 'chunked'

Dockerfile

FROM python:3.7-alpine

USER root 

ENV pythonunbuffered 1 

RUN mkdir app

COPY ./new /app
COPY ./requirements.txt /requirements.txt


RUN pip install -r /requirements.txt

WORKDIR /app

RUN adduser -D user 

USER user 

cmd ['python','manage.py','runserver']

docker-compose

version: "3"

services: 

app:
  build: 
    context: .
  ports:
    - "8000:8000"
  volumes:
    - "./src:/app"
  command: >
    sh -c "python manage.py runserver 0.0.0.0:8000"

Is there a connection error?why does this keep happening?

Hawes answered 29/8, 2023 at 17:40 Comment(2)
Please don't use the development server (manage.py) this way, put uwsgi or something in front instead.Hexagon
Follow win's suggestion. ALSO look here: https://mcmap.net/q/1174332/-sam-local-invoke-helloworldfucntion-gives-typeerror-error-request-got-an-unexpected-keyword-argument-39-chunked-39Furrow
A
19

I tried looking for this error and found that this error typically occurs when there’s a version mismatch between the Docker client and the Docker server. Here what you are using is Compose V1 and they ended support for it in July 2023.

reference: https://docs.docker.com/compose/migrate/

They changed the command from docker-compose to docker compose in Copmose V2. Try using

docker compose up --build

instead of

docker-compose up --build

I hope it helps

Aphrodisiac answered 23/11, 2023 at 11:9 Comment(1)
Yes, that is correct. Thanks.Heady
T
1

This happened to me using docker-compose v1, installed by sudo apt get docker-compose, but this version is ancient.

Try installing docker-compose v2 following these steps: https://wiki.crowncloud.net/?How_to_Install_and_use_Docker_Compose_on_Ubuntu_24_04#Install+Docker+Compose

Terrain answered 27/8 at 13:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.