8000 'docker logs -f' hangs on logfile rotation with --max-file=1 · Issue #39235 · moby/moby · GitHub
[go: up one dir, main page]

Skip to content

'docker logs -f' hangs on logfile rotation with --max-file=1 #39235

@Greek64

Description

@Greek64

Description
docker logs -f stops/hangs when the logfile rotates and max-file is configured to 1.
Increasing the max-file fixes this problem.

Steps to reproduce the issue:

  1. Start a container with a low max-size and max-file=1 that prints a lot of output:
docker run -d --name hello_loop --log-driver=json-file --log-opt max-size=1k --log-opt max-file=1 alpine /bin/ash -c 'while true; do echo "Hello"; sleep 1; done'
  1. Follow the output of the container:
docker logs -f hello_loop

Describe the results you received:

The docker logs -f hello_loop command stops showing the container output (hangs), even if the actual container is still outputting lines (can be seen by accessing the .log file directly)

Describe the results you expected:

The docker logs -f hello_loop command shows Hello messages until the command is interrupted or the container is stopped.

Output of docker version:

Client:
 Version:           18.09.6
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        481bc77
 Built:             Sat May  4 02:36:00 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.6
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       481bc77
  Built:            Sat May  4 01:59:36 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker info:

Server Version: 18.09.6
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.0-8-amd64
Operating System: Debian GNU/Linux 9 (stretch)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.56GiB
Name: WOLF-SERVER
ID: ENWT:3OUT:IXB6:VWQW:GRTZ:AOWZ:PKJN:2GAN:RLGK:UGO5:IBWU:USW7
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

WARNING: No swap limit support

Related Issues

Amongst others:
#35332
#32038

Although in one of the linked issues it was mentioned that setting max-file to 1

is a bit of an edge case since it's weird to not retain some of the logs.

this is a bug in my eyes as this behavior is not documented anywhere (that I could find).
If this behavior is to be expected, this should be documented accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0