I needed space and executed: docker rmi $(docker images -f \"dangling=true\" -q)
Since then I can\'t with docker-compose: docker-compose build
If you have tried looking through permissions, docker reset, docker system prune, deleting all containers, deleting all images (dangling or otherwise), reading about everything that there is surrounding this issue and have had no success. Try uninstalling docker and re-installing the stable version.
Although, the error I was struggling with was : Error processing tar file(exit status 1): mkdir /some/path/name: no such file or directory
I was having the same issue when i changed the Dockerfile location in a python project. I tried the accepted answer and didn't work for me.
I resolved the problem by running :
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs sudo rm -r
On the project root.
The problem was that docker-compose build was trying to read files inside pycache folders.
Maybe this also can be fixed with a proper use of .dockerignore but i dind't try it
Hope this helps.
Saludos.
There is an built in command to remove unused images (Version 1.13+):
docker image prune
Now to handle the situation:
Stop Docker Service
systemctl stop docker
Backup /var/lib/docker then:
Remove /var/lib/docker
Caution: This will remove images, containers, volumes, ... make sure you back it up first.
rm -rf /var/lib/docker
Start Docker service
systemctl start docker
Update:
As noted in the other answer, In somecases it might be file permissions issue. Please review permissions.
docker build needs read access to every file in the context directory tree. To avoid permission issues, add all your mounted directories to .dockerignore file except those used during the build. For example, for this docker-compose file:
version: '3'
services:
myservice:
build: .
volumes:
- './etc:/etc/myservice'
- './log:/var/log/myservice'
Add a .dockerignore file with this content:
/etc
/log
The problem will go away no matter the permissions of the files in your mounted directories.
The docker-compose error is not very informative so you can try to run docker on each build just to get detailed information:
$ docker build .
You will get an error like this:
error checking context: 'no permission to read from '/home/david/docker/myservice/log/2020161.log'.
For me it was a permission error.
I walked against the same exact issue as PR,
ERROR: Error processing tar file(exit status 1): unexpected EOF
My solution is dirty but worked for me
chown -R 777 /foo/bar/project
You almost always want to avoid to set permissions on 777, 655 is more reasonable.
0 = ---
1 = --x
2 = -w-
3 = -wx
4 = r-
5 = r-x
6 = rw-
7 = rwx
A more detailed explanation can be found here: https://www.pluralsight.com/blog/it-ops/linux-file-permissions
In my case, the problem was a .dump file created by one of my project's scripts.
docker-compose passes the context to the engine as a tar file, therefore, the build command was packing a tar (the .dump file) inside another tar file (the docker context) hence throwing an unexpected EOF on the context.
Since I don't need the .dump file in the container, I added it to my .dockerignore file.