Compose: AttributeError: 'NoneType' object has no attribute 'tobuf'

Created on 20 Jan 2017  路  18Comments  路  Source: docker/compose

I upgraded to the latest docker version (1.13) for mac os x and when I try to run docker-compose I get the following error:

Traceback (most recent call last):
File "", line 3, in
File "compose/cli/main.py", line 64, in main
File "compose/cli/main.py", line 116, in perform_command
File "compose/cli/main.py", line 848, in up
File "compose/project.py", line 389, in up
File "compose/service.py", line 302, in ensure_image_exists
File "compose/service.py", line 786, in build
File "site-packages/docker/api/build.py", line 139, in build
File "site-packages/docker/utils/utils.py", line 105, in tar
File "tarfile.py", line 2046, in addfile
AttributeError: 'NoneType' object has no attribute 'tobuf'

Everything was working fine on all previous versions of docker for osx until this recent upgrade

docker-py kinbug

Most helpful comment

I encountered this in my projects today. It turned out to be something compose didn't like in thetmp/sockets directory of my rails application. Adding it to my .dockerignore has resolved the issue so far.

All 18 comments

I encountered this in my projects today. It turned out to be something compose didn't like in thetmp/sockets directory of my rails application. Adding it to my .dockerignore has resolved the issue so far.

Got the same error message for any docker-compose command, just after the update. (centos image with nginx and php)

I am also getting this error after updating to Docker for Mac 1.13.0.

Update: I could build other projects just fine. I looked in the non-working project, there was a uwsgi.sock file left over that didn't need to be there. I deleted it, now I can build images again.

So the workaround seems to be, find socket files that are lying around in the project, and either delete or add to .dockerignore.

I had to downgrade to 1.12.5 to get it working again.

I have the same problem here. And there is no socket file inside my project. I will make a downgrade to make it work again. This happened to me after update to Docker for Mac 1.13.0 too.

Update: fixed removing my project and git cloning again. Maybe could be a socket file in any node package, I am not sure, I know that on my project there were not socket files that's why I am guessing it was in some node package.

I had the same issue for composing a Python project after upgrading to 1.13.0 on a Mac. It got resolved by cloning the project directory again.

Thanks for the report everyone.

For those who have encountered the bug, could you provide your OS (It seems like everyone here is on OSX?) as well as the output of docker-compose version?

Thanks again.

Mac OS X El Capitan 10.11.6
docker-compose version 1.10.0, build 4bd6f1a
docker-py version: 2.0.1
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2j  26 Sep 2016

For my project, it seems to dislike the socket I have under tmp/sockets

ls -la tmp/sockets
total 0
drwxr-xr-x  4 me  staff  136 Dec 12 12:37 .
drwxr-xr-x  7 me  staff  238 Jan 23 08:15 ..
srwxrwxrwx  1 me  staff    0 Oct  3 09:40 server.sock

OSX Sierra

docker-compose version 1.9.0, build 2585387
docker-py version: 1.10.6
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016

MacOS 10.11.6
docker-compose version 1.10.0, build 4bd6f1a
docker-py version: 2.0.1
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2j  26 Sep 2016
macOS Sierra: version 10.12.2
docker-compose version 1.10.0, build 4bd6f1a
docker-py version: 2.0.1
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2j  26 Sep 2016

The issue came back for me. It happens when docker-compose up is trying to rebuild an image. I get it when I try docker-compose up --build or docker-compose build. Any other solution instead of cloning again every time?!?

@atamahjoubfar Do you have any socket file in your build context? What does find . -name '*.sock' output? What about find -type s ?

@shin- Yes, I do have a socket file in my build. Both of the outputs are the same socket file:

ata@macbook:~$ find . -type s
./socket/mysocket.sock
ata@macbook:~$ find . -name '*.sock'
./socket/mysocket.sock

@atamahjoubfar Add it to your .dockerignore, that should solve the issue for the time being.

Had the same issue on OSX with Docker 1.13.0, docker-compose version:

docker-compose version 1.10.0, build 4bd6f1a docker-py version: 2.0.1 CPython version: 2.7.12 OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016

There was indeed a stray stats.socket file in the build directory; removing it fixed the issue. 馃憤

Linux 4.7.0-0.bpo.1-amd64 x86_64 GNU/Linux
docker-compose version 1.11.1, build 7c5d5e4
docker-py version: 2.0.2
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.0.1t 3 May 2016

There was also a socket in .ppm/run/controller.sock, also in my case after removing it fixed the issue.

Thanks all, the issue was identified, a fix is in docker-py's master branch https://github.com/docker/docker-py/pull/1408 and will be part of an upcoming release.

Was this page helpful?
0 / 5 - 0 ratings