-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Closed
Labels
area/loggingarea/systemdkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.status/confirmedversion/24.0
Description
Description
When journald log-driver is used, running docker logs --follow --tail would not follow logs if started before any output is produced.
Reproduce
-
Enable journald logging driver by putting
{ "log-driver": "journald" }into/etc/docker/daemon.json. -
Run the following script:
#!/bin/sh
trap 'docker kill logs-test' EXIT
docker kill logs-test
docker run --rm --name logs-test --detach alpine sh -c 'sleep 1; while sleep 0.1; do echo $((N++)); done'
# sleep 2
docker logs --follow --tail 1 logs-testExpected behavior
Expected result: it should print container output, i.e.,0, 1, 2, 3, and so on.
Actual result: it prints nothing. However, if you un-comment the sleep 2 line, it will print the numbers as expected.
docker version
Client:
Version: 24.0.7
API version: 1.43
Go version: go1.21.3
Git commit: afdd53b4e3
Built: Sun Oct 29 15:42:02 2023
OS/Arch: linux/amd64
Context: default
Server:
Engine:
Version: 24.0.7
API version: 1.43 (minimum version 1.12)
Go version: go1.21.3
Git commit: 311b9ff0aa
Built: Sun Oct 29 15:42:02 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.7.11
GitCommit: 64b8a811b07ba6288238eefc14d898ee0b5b99ba.m
runc:
Version: 1.1.10
GitCommit:
docker-init:
Version: 0.19.0
GitCommit: de40ad0docker info
Client:
Version: 24.0.7
Context: default
Debug Mode: false
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 1
Server Version: 24.0.7
Storage Driver: overlay2
Backing Filesystem: btrfs
Supports d_type: true
Using metacopy: true
Native Overlay Diff: false
userxattr: false
Logging Driver: journald
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.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 64b8a811b07ba6288238eefc14d898ee0b5b99ba.m
runc version:
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.6.7-arch1-1
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.926GiB
Name: archlinux
ID: bb0ac9f5-421b-45df-9718-ef4d1d752224
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: falseAdditional Info
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/loggingarea/systemdkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.status/confirmedversion/24.0