Docker ERROR: Error processing tar file(exit status 1): unexpected EOF

前端 未结 13 2196
离开以前
离开以前 2020-12-14 06:12

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

Since then I can\'t with docker-compose: docker-compose build

13条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-14 06:34

    Solving this error for good

    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.

    How to get a more informative error

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

提交回复
热议问题