on building docker image level=error msg="Can't close tar writer: io: read/write on closed pipe"
Asked Answered
I

10

36
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.

Inheritor answered 27/10, 2017 at 8:57 Comment(0)
P
100

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

Protochordate answered 17/12, 2020 at 1:36 Comment(5)
Can't believe I fell for this! 😝 – Glasswork
Simultaneously felt dumb and relieved after seeing this 🀣 – Glassworks
You mean Docker Desktop right? Whether or not the docker hub website is running is out of my control. – Eanes
In my case I had to close and reopen it :) – Naturalize
Please also explain the error message and how you figured out this was the problem. – Sandblind
C
16

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.

Christos answered 28/10, 2017 at 3:19 Comment(2)
Thanks, a debugging session was still active. – Meier
THANKS! And in my case - they were opened (and being debugged) in Visual Studio. Grrr. I'm feeling pretty dumb... – Paling
R
9

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

Radu answered 1/7, 2019 at 16:47 Comment(0)
I
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/ 
Inheritor answered 28/10, 2017 at 19:26 Comment(1)
Where I can find the setting file? – Satterwhite
W
3

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!

Westberg answered 13/1, 2020 at 20:17 Comment(0)
U
1

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.

Upperclassman answered 15/4, 2022 at 21:41 Comment(0)
B
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.

Blood answered 28/10, 2017 at 8:6 Comment(0)
W
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.

Weatherley answered 5/11, 2021 at 9:25 Comment(0)
M
0

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

Medicable answered 22/6, 2022 at 11:30 Comment(0)
V
0

Use this command to give permissions

sudo chmod 666 /var/run/docker.sock
Vermifuge answered 21/3, 2023 at 18:43 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.