30
time="2017-10-27T07:39:20Z" level=error msg="Can't add file /var/app/current/app/content_classifier/forest.pickle to tar: io: read/write on closed pipe" 
time="2017-10-27T07:39:20Z" level=error msg="Can't close tar writer: io: read/write on closed pipe"
Failed to build Docker image aws_beanstalk/staging-app:  tar writer: io: read/write on closed pipe" 
Error response from daemon: Untar error on re-exec cmd: fork/exec /proc/self/exe: cannot allocate memory. Check snapshot logs for details. (Executor::NonZeroExitStatus)

I have a Pickle object in django_app/content_classifer object. There is a class to predict the result and it's initializing itself when celery tasks file gets initialised.

docker build keeps failing after giving an error message as in the title.

Matt Cremeens
  • 4,951
  • 7
  • 38
  • 67
Aniket patel
  • 551
  • 1
  • 5
  • 17

10 Answers10

94

if you are on Mac, make sure docker desktop is running

rezan21
  • 1,065
  • 10
  • 14
14

I had same issue few minutes ago, when I found your issue :) I had some files opened = they were used by another application(GIT)

Please make sure that no files are being used.

Hope it will help.

Luk3rson
  • 151
  • 1
  • 4
9

I had this problem in Ubuntu and sudo service docker restart fixed it

benhsu
  • 5,346
  • 8
  • 39
  • 47
5

The problem faced because the process that generates the pickle object has a diffrent user assigned then process that was accessing the pickle object.

I define the location for pickle object in the setting file.

picklefile = "usr/local/webapp/forest.pickle"

I simply added the step as following in Dockerfile.

RUN chown -R /user/local/webapp/ 
Aniket patel
  • 551
  • 1
  • 5
  • 17
4

I had the same problem. If you are using Docker on Windows using Docker Toolbox you should first run the Docker Quickstart Terminal, otherwise, it will not work. Hope this helps someone!

Oscar2av
  • 41
  • 2
0

It seems that this is an Input/Output error and the docker couldn't access the files it wants to. As suggested by @Luk3rson make sure that the files are not used by any other application. Try to debug the logs in /var/log/. May it help you.

Rushal Verma
  • 416
  • 3
  • 13
0

I had a similar error when I was using a Docker context for a remote Docker host. After reverting to the Docker daemon on my local machine (Linux) everything worked again.

Matthew Setter
  • 2,397
  • 1
  • 19
  • 18
0

For me when I was running it with WSL 2, I just had to add sudo to the docker command and it was all good.

Tina J
  • 4,983
  • 13
  • 59
  • 125
0

Restart your docker hub if you are on Mac. Docker was already running but restarting it did the trick for me.

adam shamsudeen
  • 1,752
  • 15
  • 14
0

Use this command to give permissions

sudo chmod 666 /var/run/docker.sock