docker-compose logs -f
백그라운드에서 컨테이너의 로그를 보고 이를 따라가면 새 항목을 즉시 볼 수 있는 유용한 명령입니다. 최신 안정 버전 V2.1.0에서는 control-c더 이상 이러한 포그라운드 프로세스를 종료할 수 없는 것 같습니다 .
$ docker-compose logs -f
...
webserver-1 | [Sat Nov 13 12:10:33.814463 2021] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
^C^C^C
^C
프로세스를 종료하지 않고 인쇄만 합니다 . 여러 번 눌러도(일반적으로 프로세스가 즉시 종료됨) 아무 일도 일어나지 않습니다. 작동하는 유일한 것은control-\, 거대한 스택 추적을 인쇄합니다.
^C^C^C^\SIGQUIT: quit
PC=0x7b950 m=0 sigcode=128
goroutine 0 [idle]:
runtime.futex(0x1491b10, 0x80, 0x0, 0x0, 0x0, 0x0, 0x56a08, 0x18473b0, 0x1a9d8, 0x4c394, ...)
runtime/sys_linux_arm.s:443 +0x1c
runtime.futexsleep(0x1491b10, 0x0, 0xffffffff, 0xffffffff)
runtime/os_linux.go:44 +0x184
runtime.notesleep(0x1491b10)
runtime/lock_futex.go:159 +0xac
runtime.mPark()
runtime/proc.go:1340 +0x20
runtime.stopm()
runtime/proc.go:2301 +0x78
runtime.findrunnable(0x1846000, 0x0)
runtime/proc.go:2960 +0x84c
runtime.schedule()
runtime/proc.go:3169 +0x2bc
runtime.park_m(0x18821c0)
runtime/proc.go:3318 +0x80
runtime.mcall(0x78b1c)
runtime/asm_arm.s:285 +0x5c
goroutine 1 [semacquire, 5 minutes]:
sync.runtime_Semacquire(0x187aea4)
runtime/sema.go:56 +0x34
sync.(*WaitGroup).Wait(0x187aea4)
sync/waitgroup.go:130 +0x84
golang.org/x/sync/errgroup.(*Group).Wait(0x187aea0, 0x1b27380, 0x1bbe440)
golang.org/x/[email protected]/errgroup/errgroup.go:40 +0x24
github.com/docker/compose/v2/pkg/compose.(*composeService).Logs(0x1ae6370, 0xe3c114, 0x180af60, 0x18a0a20, 0x11, 0xe37fc8, 0x187ac60, 0x189d798, 0x0, 0x1, ...)
github.com/docker/compose/v2/pkg/compose/logs.go:56 +0x214
github.com/docker/compose/v2/pkg/api.(*ServiceProxy).Logs(0x19081c0, 0xe3c114, 0x180af60, 0x18a0a20, 0x11, 0xe37fc8, 0x187ac60, 0x189d798, 0x0, 0x1, ...)
github.com/docker/compose/v2/pkg/api/proxy.go:200 +0x6c
github.com/docker/compose/v2/cmd/compose.runLogs(0xe3c114, 0x180af60, 0xe45a9c, 0x19081c0, 0x19bb540, 0x0, 0x1, 0xca45ce, 0x3, 0x0, ...)
github.com/docker/compose/v2/cmd/compose/logs.go:71 +0x180
github.com/docker/compose/v2/cmd/compose.logsCommand.func1(0xe3c114, 0x180af60, 0x189d798, 0x0, 0x1, 0x18000e0, 0xa92b3c)
github.com/docker/compose/v2/cmd/compose/logs.go:50 +0x6c
github.com/docker/compose/v2/cmd/compose.Adapt.func1(0xe3c114, 0x180af60, 0x1927ce0, 0x189d798, 0x0, 0x1, 0x12, 0x588734)
github.com/docker/compose/v2/cmd/compose/compose.go:85 +0x44
github.com/docker/compose/v2/cmd/compose.AdaptCmd.func1(0x1927ce0, 0x189d798, 0x0, 0x1, 0x0, 0x0)
github.com/docker/compose/v2/cmd/compose/compose.go:64 +0x104
github.com/spf13/cobra.(*Command).execute(0x1927ce0, 0x189f720, 0x1, 0x1, 0x1927ce0, 0x189f720)
github.com/spf13/[email protected]/command.go:856 +0x354
github.com/spf13/cobra.(*Command).ExecuteC(0x1c79b80, 0x1c79b80, 0x189f710, 0x3)
github.com/spf13/[email protected]/command.go:974 +0x280
github.com/spf13/cobra.(*Command).Execute(...)
github.com/spf13/[email protected]/command.go:902
github.com/docker/cli/cli-plugins/plugin.RunPlugin(0x19080e0, 0x19271e0, 0xca53b9, 0x5, 0xcaca17, 0xb, 0xe1bba4, 0x6, 0x0, 0x0, ...)
github.com/docker/[email protected]+incompatible/cli-plugins/plugin/plugin.go:51 +0xe8
github.com/docker/cli/cli-plugins/plugin.Run(0xd1f2d8, 0xca53b9, 0x5, 0xcaca17, 0xb, 0xe1bba4, 0x6, 0x0, 0x0, 0x0, ...)
github.com/docker/[email protected]+incompatible/cli-plugins/plugin/plugin.go:64 +0xdc
main.pluginMain()
github.com/docker/compose/v2/cmd/main.go:41 +0x6c
main.main()
github.com/docker/compose/v2/cmd/main.go:74 +0x138
goroutine 33 [chan send, 5 minutes]:
github.com/docker/compose/v2/cmd/formatter.init.0.func1(0x1b199e0)
github.com/docker/compose/v2/cmd/formatter/colors.go:120 +0x224
created by github.com/docker/compose/v2/cmd/formatter.init.0
github.com/docker/compose/v2/cmd/formatter/colors.go:104 +0x1fc
goroutine 8 [chan receive]:
k8s.io/klog/v2.(*loggingT).flushDaemon(0x14914f0)
k8s.io/klog/[email protected]/klog.go:1164 +0x70
created by k8s.io/klog/v2.init.0
k8s.io/klog/[email protected]/klog.go:418 +0x100
goroutine 36 [syscall, 5 minutes]:
os/signal.signal_recv(0xe35dd8)
runtime/sigqueue.go:168 +0x158
os/signal.loop()
os/signal/signal_unix.go:23 +0x14
created by os/signal.Notify.func1.1
os/signal/signal.go:151 +0x34
goroutine 15 [chan receive, 5 minutes]:
github.com/docker/compose/v2/pkg/compose.(*printer).Run(0x1bc60a0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
github.com/docker/compose/v2/pkg/compose/printer.go:66 +0x94
github.com/docker/compose/v2/pkg/compose.(*composeService).Logs.func2(0x0, 0x0)
github.com/docker/compose/v2/pkg/compose/logs.go:45 +0x44
golang.org/x/sync/errgroup.(*Group).Go.func1(0x187aea0, 0x1bc60b0)
golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go
golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x50
trap 0x0
error 0x0
oldmask 0x0
r0 0x1491b10
r1 0x80
r2 0x0
r3 0x0
r4 0x0
r5 0x0
r6 0x0
r7 0xf0
r8 0x7
r9 0x1
r10 0x1491588
fp 0x7
ip 0x1491758
sp 0xbed1843c
lr 0x42fac
pc 0x7b950
cpsr 0xa0000010
fault 0x0
V1.21.0이 설치된 기존 테스트 시스템에서는 정상적으로 작동합니다 control-c.
$ docker-compose logs -f
nextcloud_redis | 1:M 26 Sep 2021 19:58:26.051 * 100 changes in 300 seconds. Saving...
^CERROR: Aborting.
control-cV2.1.0 docker-compose 버전이 왜 아무것도 하지 않는지 아시나요 ? 이것은 제가 본 첫 번째 CLI 앱인데 작동하지 않습니다. 나는 전에는 그것을 전혀 몰랐습니다 control-\. 위에 표시된 것처럼 이동 중에 발생한 수많은 로그 항목으로 터미널이 복잡해지기 때문에 이는 나에게 좋은 옵션이 아닌 것 같습니다.
MobaXterm을 사용하여 다른 Linux 상자와 Windows에서도 테스트해 본 결과 이는 내 클라이언트에 문제가 되지 않는 것 같습니다. 내 주요 클라이언트는 Manjaro 21.1.6이며, Raspbian 10 Buster(중요한 경우)가 포함된 Raspberry Pi 4에서 Docker-Compose가 실행됩니다.
답변1
이것은 알려진 버그입니다. 이것은 지금이다안정적인Docker Compose 2.2.2에서