Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.28.5 docker-compose to remote linux over SSH -> Can't add file XX to tar: io: read/write on closed pipe #8218

Closed
pnutshellmenace opened this issue Mar 18, 2021 · 14 comments

Comments

@pnutshellmenace
Copy link

Description of the issue

Running docker-compose from Windows WSL2 (Ubuntu) to remote linux host:

DOCKER_HOST="ssh://user@remotehost" docker-compose -f "docker-compose.yml" up --build -d

produces the following error:

ERRO[0002] Can't add file XX to tar: io: read/write on closed pipe 
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=XXXX&target=&ulimits=null&version=1: write |1: broken pipe
ERRO[0002] Can't close tar writer: io: read/write on closed pipe 
ERROR: Service 'XXXX' failed to build

The reported file is always the first file in the build that it is trying to tar, so it appears the command bombs right at the beginning of the build.

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.28.5, build c4eb3a1f
docker-py version: 4.4.4
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

Output of docker version

Client: Docker Engine - Community
 Cloud integration: 1.0.9
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:17:50 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.5
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       363e9a8
  Built:            Tue Mar  2 20:15:47 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc:
  Version:          1.0.0-rc92
  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Steps to reproduce the issue

  1. DOCKER_HOST="ssh://user@remotehost" docker-compose -f "docker-compose.yml" up --build -d

Observed result

ERRO[0002] Can't add file XX to tar: io: read/write on closed pipe 
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=XXXX&target=&ulimits=null&version=1: write |1: broken pipe
ERRO[0002] Can't close tar writer: io: read/write on closed pipe 
ERROR: Service 'XXXX' failed to build

Expected result

Build should work without error

Additional information

This worked correctly with docker-compose 1.27.4

@dometec
Copy link

dometec commented May 17, 2021

Same with 1.29.1

@raphaelvigee
Copy link

raphaelvigee commented Aug 3, 2021

This is indeed still happening on 1.29.2, setting DOCKER_HOST to ssh://user@ip leads to this error while i can ssh to the target machine no problem. This issue happens on linux

@raphaelvigee
Copy link

It seems like setting COMPOSE_DOCKER_CLI_BUILD=0 gets it to work

@adamevince
Copy link

It seems like setting COMPOSE_DOCKER_CLI_BUILD=0 gets it to work

I'm having this issue using docker context to deploy remotely from jenkins build server. Do you mean setting compose_docker_cli_build=0 on the remote?

@briancaffey
Copy link

I'm having this issue as well. Trying to deploy containers to a raspberry pi from a mac over SSH, setting DOCKER_HOST to shh://root@192.168.1.11. I'm not using docker-compose, I'm using docker cli in a shell script.

docker --version
Docker version 20.10.6, build 370c289

Error:

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

@adamevince
Copy link

It seems like setting COMPOSE_DOCKER_CLI_BUILD=0 gets it to work

I'm having this issue using docker context to deploy remotely from jenkins build server. Do you mean setting compose_docker_cli_build=0 on the remote?

My issue was caused by improper permissions. Using sudo fixed it for me.

@SonnyAD
Copy link

SonnyAD commented Aug 19, 2021

erver. Do you mean setting compose_docker_cli_build=0 on the remote?

Nope, on the machine you run docker-compose. On my end I do something like COMPOSE_DOCKER_CLI_BUILD=0 docker-compose up -d

@NanoBjorn
Copy link

NanoBjorn commented Oct 28, 2021

It seems like setting COMPOSE_DOCKER_CLI_BUILD=0 gets it to work

Also worked for me, but I had it enabled on purpose because non-cli build produces different sha hashes of layers and therefore build with docker build does not hit those caches

btw docker compose works fine for me

@stale
Copy link

stale bot commented Apr 27, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 27, 2022
@stale
Copy link

stale bot commented Nov 2, 2022

This issue has been automatically closed because it had not recent activity during the stale period.

@stale stale bot closed this as completed Nov 2, 2022
@BigTarr
Copy link

BigTarr commented Jan 14, 2023

I'm having this issue as well. Trying to deploy containers to a raspberry pi from a mac over SSH, setting DOCKER_HOST to shh://root@192.168.1.11. I'm not using docker-compose, I'm using docker cli in a shell script.

docker --version
Docker version 20.10.6, build 370c289

Error:

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

Did you get a fix?

@tanzislam
Copy link

It seems like setting COMPOSE_DOCKER_CLI_BUILD=0 gets it to work

I'm having this issue using docker context to deploy remotely from jenkins build server. Do you mean setting compose_docker_cli_build=0 on the remote?

My issue was caused by improper permissions. Using sudo fixed it for me.

For me sudo fixed it as well, but for a completely different reason. 😅 Apparently the remote-daemon protocol is sensitive to the HTTP_PROXY/HTTPS_PROXY/http_proxy/https_proxy environment variables, and those are what got cleared using sudo. (sudo -E would still reproduce the problem.)

My fix was to enlist the daemon address in NO_PROXY/no_proxy.

@erlangparasu
Copy link

Got same issue

@DrunkenBeetle
Copy link

DrunkenBeetle commented May 1, 2024

If running compose within a container (docker-in-a-docker setup) then you need to supply COMPOSE_DOCKER_CLI_BUILD=0 as an env variable when running the container (docker run -e COMPOSE_DOCKER_CLI_BUILD=0 ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests