goldmann / docker-squash

Docker image squashing tool
MIT License
831 stars 108 forks source link

AttributeError: module 'docker' has no attribute 'version_info' #212

Closed larytet closed 1 year ago

larytet commented 2 years ago

The log looks like

docker-squash --tag test1:5.5.5-0.2.squashed  test1:5.5.5-0.2

2022-09-02 08:06:33,283 root         INFO     docker-squash version 1.0.9, Docker 75249d8, API 1.41...
2022-09-02 08:06:33,283 root         INFO     Using v2 image format
2022-09-02 08:06:33,293 root         INFO     Old image has 11 layers
2022-09-02 08:06:33,293 root         INFO     Checking if squashing is necessary...
2022-09-02 08:06:33,293 root         INFO     Attempting to squash last 11 layers...
2022-09-02 08:06:33,293 root         INFO     Saving image sha256:0883438f9c8b4ec38bd5ec0363d9043c87537a8922e6943d80a57dbbecf46b6c to /tmp/docker-squash-dr0cg_pu/old directory...
2022-09-02 08:06:34,129 root         ERROR    module 'docker' has no attribute 'version_info'
Traceback (most recent call last):
  File "/home/arkady/.local/lib/python3.8/site-packages/docker_squash/image.py", line 357, in _save_image
    if docker.version_info[0] < 3:
AttributeError: module 'docker' has no attribute 'version_info'
larytet commented 2 years ago

Try pip3 install docker==5.0.3

tiagao86 commented 2 years ago

It worked for me!

larytet commented 2 years ago

Adding version could help too

# docker build --build-args VERSION=`git rev-list --max-count=1 HEAD`
ARG VERSION

LABEL maintainer="I am"
LABEL description="My Docker image"
LABEL version="${VERSION}"

I didn't test it.

lystopad commented 2 years ago

Try pip3 install docker==5.0.3

Works for me as well. Thanks!

Is there any better solutions instead of using previous version?

Thanks.

goldmann commented 1 year ago

Should be fixed with #216, thank you!