On Building Docker Image Level=Error Msg="Can't Close Tar Writer: Io: Read/Write on Closed Pipe"

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

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/ 

Unable to build docker container: Can't add file file to tar: io: read/write on closed pipe

I didn't have certificate-based SSH access setup between my raspberry pi and Mac. Adding -l "debug" to my docker build made this clear:

DEBU[0000] commandconn: starting ssh with [-l ubuntu -- 192.168.1.11 docker system dial-stdio] 
EBU[0000] commandconn (ssh):Permission denied, please try again.
EBU[0000] commandconn (ssh):Permission denied, please try again.
EBU[0000] commandconn (ssh):ubuntu@192.168.1.11: Permission denied (publickey,password).
DEBU[0000] commandconn: starting ssh with [-l ubuntu -- 192.168.1.11 docker system dial-stdio]
EBU[0000] commandconn (ssh):Permission denied, please try again.
EBU[0000] commandconn (ssh):Permission denied, please try again.
EBU[0000] commandconn (ssh):ubuntu@192.168.1.11: Permission denied (publickey,password).
DEBU[0000] commandconn: starting ssh with [-l ubuntu -- 192.168.1.11 docker system dial-stdio]
EBU[0000] commandconn (ssh):Permission denied, please try again.
EBU[0000] commandconn (ssh):Permission denied, please try again.
EBU[0000] commandconn (ssh):ubuntu@192.168.1.11: Permission denied (publickey,password).
DEBU[0000] commandconn: starting ssh with [-l ubuntu -- 192.168.1.11 docker system dial-stdio]
EBU[0000] commandconn (ssh):Permission denied, please try again.
EBU[0000] commandconn (ssh):Permission denied, please try again.
EBU[0000] commandconn (ssh):ubuntu@192.168.1.11: Permission denied (publickey,password).
DEBU[0000] commandconn: starting ssh with [-l ubuntu -- 192.168.1.11 docker system dial-stdio]
EBU[0000] commandconn (ssh):Permission denied, please try again.
EBU[0000] commandconn (ssh):Permission denied, please try again.
EBU[0000] commandconn (ssh):ubuntu@192.168.1.11: Permission denied (publickey,password).
ERRO[0000] Can't add file <file> to tar: io: read/write on closed pipe
ERRO[0000] Can't close tar writer: io: read/write on closed pipe
DEBU[0000] FIXME: Got an status-code for which error does not match any expected type!!!: -1 module=api status_code=-1
error during connect: Post "http://docker/v1.24/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&shmsize=0&t=localhost%3A5000%2Fbackend%3Ae150d93&target=&ulimits=null&version=1": write |1: broken pipe

To setup passworldless authentication to my raspberry pi, I followed this guide: https://www.raspberrypi.org/documentation/remote-access/ssh/passwordless.md

Also, in order to build the container on raspberry pi, I needed to use the python:3.8 base image with the platform linux/arm64. Here's the docker build command I used:

docker \
-l "debug" \
build \
--platform linux/arm64 \
-t $REGISTRY/backend:$VERSION \
-f backend/Dockerfile \
./backend/

Issues with building Dockerfile

@divan_cyph make sure you have docker running. You can check by executing docker info from your cli.

Side note, you can save a couple of lines by just adding your COPY . . above the go mod download call, and removing both COPY go.mod . and COPY go.sum .

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

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.

Issues with building Dockerfile

@divan_cyph make sure you have docker running. You can check by executing docker info from your cli.

Side note, you can save a couple of lines by just adding your COPY . . above the go mod download call, and removing both COPY go.mod . and COPY go.sum .



Related Topics



Leave a reply



Submit