https://prefect.io logo
Title
d

Deceivious

05/05/2023, 3:35 PM
Hi Prefect Community, I just upgraded from 2.10.4 to 2.10.7. I used to use
from prefect.packaging.docker import DockerPackager
docker = DockerPackager(
        dockerfile=str(Path("Dockerfile").resolve()),
        image_flow_location=flow_path,
        registry_url=config.get("AZURE_REGISTRY", "DOCKER_REGISTRY_URL"),
    )
docker_manifest = await docker.package(flow=flow)
to build and push images and use the manifest on kubernetes
infra_overrides
. However the
package
method is now raising issue.
File "/home/dcvs/source_code/archimedes_etl_flows/.venv/lib/python3.10/site-packages/docker/api/client.py", line 221, in _retrieve_server_version
    raise DockerException(
docker.errors.DockerException: Error while fetching server API version: HTTPConnection.request() got an unexpected keyword argument 'chunked'
1
Relevant extra log :
File "/home/dcvs/source_code/archimedes_etl_flows/archimedes_data_fetcher/utils/prefect_deploy_utils.py", line 53, in build_docker_flow
    docker_manifest = await docker.package(flow=flow)
  File "/home/dcvs/source_code/archimedes_etl_flows/.venv/lib/python3.10/site-packages/prefect/packaging/docker.py", line 91, in package
    image_reference = await self._build_image(flow)
  File "/home/dcvs/source_code/archimedes_etl_flows/.venv/lib/python3.10/site-packages/prefect/packaging/docker.py", line 105, in _build_image
    return await self._build_from_dockerfile()
  File "/home/dcvs/source_code/archimedes_etl_flows/.venv/lib/python3.10/site-packages/prefect/packaging/docker.py", line 111, in _build_from_dockerfile
    return await run_sync_in_worker_thread(
  File "/home/dcvs/source_code/archimedes_etl_flows/.venv/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 91, in run_sync_in_worker_thread
    return await anyio.to_thread.run_sync(
  File "/home/dcvs/source_code/archimedes_etl_flows/.venv/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/home/dcvs/source_code/archimedes_etl_flows/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/home/dcvs/source_code/archimedes_etl_flows/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/home/dcvs/.pyenv/versions/3.10.8/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/dcvs/source_code/archimedes_etl_flows/.venv/lib/python3.10/site-packages/prefect/docker.py", line 148, in build_image
    with docker_client() as client:
  File "/home/dcvs/.pyenv/versions/3.10.8/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "/home/dcvs/source_code/archimedes_etl_flows/.venv/lib/python3.10/site-packages/prefect/docker.py", line 102, in docker_client
    client = docker.DockerClient.from_env()
  File "/home/dcvs/source_code/archimedes_etl_flows/.venv/lib/python3.10/site-packages/docker/client.py", line 96, in from_env
    return cls(
  File "/home/dcvs/source_code/archimedes_etl_flows/.venv/lib/python3.10/site-packages/docker/client.py", line 45, in __init__
    self.api = APIClient(*args, **kwargs)
  File "/home/dcvs/source_code/archimedes_etl_flows/.venv/lib/python3.10/site-packages/docker/api/client.py", line 197, in __init__
    self._version = self._retrieve_server_version()
  File "/home/dcvs/source_code/archimedes_etl_flows/.venv/lib/python3.10/site-packages/docker/api/client.py", line 221, in _retrieve_server_version
    raise DockerException(
docker.errors.DockerException: Error while fetching server API version: HTTPConnection.request() got an unexpected keyword argument 'chunked'
Reverting to
2.10.6
fixes the issue.
z

Zanie

05/05/2023, 4:04 PM
Hm sounds like an incompatibility between Docker-py and the Docker server?
I don’t think we use
chunked
ourselves
Also fun to see you’re using my Docker packager 😄
d

Deceivious

05/05/2023, 4:04 PM
I use poetry and literally nothing has changed on the lock file for the docker
z

Zanie

05/05/2023, 4:05 PM
That’s so weird
d

Deceivious

05/05/2023, 4:05 PM
Ive reverted to 2.10.6 pushed my flow changed while leaving my server and agents at 2.10.7 for now
z

Zanie

05/05/2023, 4:05 PM
What does
pip freeze | grep docker
show before and after upgrading?
d

Deceivious

05/05/2023, 4:07 PM
is that the new Env flag?
the one with HTTPv2 enable / diable
ah no its different
Testing it thanks
@Zanie Binding the requests version to
<2.29.0
worked for me. Might be a good idea to push an announcement regarding the issue? Also regarding the docker package, as long as it works Ill use it 😄 👍
THank you!