-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Description
Description
It used to be possible to just capture a docker-compose exec output and manipulate it later. Now even pipes in bash completely breaks because the command is not outputting to stdout anymore, and piping stderr to stdout doesn't work as a workaround.
Steps to reproduce the issue:
- We need a persistent docker-compose.yml service, so I will just use nginx for this purpose:
version: "3"
services:
nginx:
image: nginxdocker-compose up -d nginx- Try to capture the output of an execution in the running container fails, for instance
docker-compose exec nginx echo true | grep falsewill output true.
Describe the results you received:
It is impossible to capture the output of the command anymore. FOO=$(docker-compose exec nginx echo true) bash -c 'echo $FOO | grep false' will output true. For a sanity check, just run FOO=$(echo true) bash -c 'echo $FOO | grep false' and it outputs nothing.
Describe the results you expected:
To be able to capture docker-compose exec command output in a variable, use it in a pipe or redirect to a file.
Additional information you deem important (e.g. issue happens only occasionally):
Output of docker compose version:
Docker Compose version 2.2.3
Output of docker info:
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.7.1-docker)
compose: Docker Compose (Docker Inc., 2.2.3)
Server:
Containers: 5
Running: 4
Paused: 0
Stopped: 1
Images: 54
Server Version: 20.10.12
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: false
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: docker-init
containerd version: 1407cab509ff0d96baa4f0eb6ff9980270e6e620.m
runc version: v1.0.3-0-gf46b6ba2
init version: de40ad0
Security Options:
seccomp
Profile: default
cgroupns
Kernel Version: 5.15.14-1-lts
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.53GiB
Name: chamon-anarchy
ID: C6IX:KAHG:U45S:UDYA:G3OE:FO5M:ZCDK:PLCI:JKNO:XVD5:YTL3:3IGA
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Additional environment details: