Docker ERROR: Error processing tar file(exit s

2020-02-08 10:06发布

I needed space and executed: docker rmi $(docker images -f "dangling=true" -q)

Since then I can't with docker-compose: docker-compose build, I get the error: ERROR: Error processing tar file(exit status 1): unexpected EOF.

I tried to remove all images, reinstall docker, but nothing will do: always the same error, after quite some time.

I built on another system and it worked, which suggests that this is a wrong-state issue.

Any idea what I should clean?

Using:

▶ docker version
Client:
 Version:      17.03.0-ce
 API version:  1.24 (downgraded from 1.26)
 Go version:   go1.7.5
 Git commit:   3a232c8
 Built:        Tue Feb 28 08:01:32 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.6
 API version:  1.24 (minimum version )
 Go version:   go1.6.2
 Git commit:   78d1802
 Built:        Tue Jan 31 23:35:14 2017
 OS/Arch:      linux/amd64
 Experimental: false

▶ docker-compose version
docker-compose version 1.11.2, build dfed245
docker-py version: 2.1.0
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.0.1t  3 May 2016

12条回答
We Are One
2楼-- · 2020-02-08 10:33

I had the same issue and the approved answer didn't work for me.

Turns out I had a file with permissions which didn't allow the user running docker-compose to read it. After removing the file everything was OK

查看更多
你好瞎i
3楼-- · 2020-02-08 10:34

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.

查看更多
闹够了就滚
4楼-- · 2020-02-08 10:36

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

查看更多
贼婆χ
5楼-- · 2020-02-08 10:37

Try increasing the memory for Docker, it fixed the issue for me.

Docker memory setting in Preferences was set to 2GB, so when pulling the ~3GB image, I was getting exactly this error:

$ docker pull skymindops/skil-ce
latest: Pulling from skymindops/skil-ce
118c5f2883d6: Pull complete 
3d199b2e6224: Extracting [==================================================>]  2.902GB/2.902GB
failed to register layer: Error processing tar file(exit status 1): unexpected EOF

Increasing the memory limit fixed it (I also increased the swap, but unsure was it required or not).

查看更多
再贱就再见
6楼-- · 2020-02-08 10:43

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

查看更多
干净又极端
7楼-- · 2020-02-08 10:46

I found a temporary solution:

  1. Ensure specify the image name on docker-compose.yml for example, specify the image name and container_name as django_practice_db/django_practice_web

    services:
      django_practice_db:
        image: postgres
        container_name: django_practice_db
      django_practice_web:
        container_name: django_practice_web
        build: .
        command: pipenv run python manage.py runserver 0.0.0.0:8000`
    
  2. Copy the project file to another place

  3. Go inside the copied project directory

  4. Execute docker-compose build

  5. Go back to the original project directory

  6. Execute docker-compose up

Not sure why I can build images when I change the folder path.

查看更多
登录 后发表回答