Skip to content

Docker log rotation is not working the container log keeps on growing #1148

Closed
@avi-kalar

Description

@avi-kalar

I have an issue that even though I set the docker log configuration it does not kick in and my docker logs grows till I run out of disk space. Can you please tell me when the log rotation is cleaned up, I have the following config set for my container when I run

docker inspect <container-id>

      `"LogConfig": {
            "Type": "json-file",
            "Config": {
                "max-file": "5",
                "max-size": "100m"
            }
        }`

and my log size is above 400 MB right now, but the log rotation hasn't kicked in.

Steps to reproduce the issue:

  1. docker run --name badguy --log-opt max-size=1k --log-opt max-file=5 -d ubuntu sh -c "while true; do printf A; done"
  2. wait for a while
  3. docker kill badgu

Describe the results you received:
my log size is above 1k right now, but the log rotation hasn't kicked in.

Describe the results you expected:
Log rotation with file size not exceeding 1k

Output of docker version:


Output of docker info:

Containers: 39
 Running: 1
 Paused: 0
 Stopped: 38
Images: 1441
Server Version: 17.03.1-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 1214
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 4ab9917febca54791c5f071a9d1f404867857fcc
runc version: 54296cf40ad8143b62dbcaa1d90e520a2136ddfe
init version: N/A (expected: 949e6facb77383876aeff8a6944dde66b3089574)
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.13-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952 GiB
Name: moby
ID: 6GE7:EIWS:LOD2:IFS2:3UHV:A62R:FWGU:RYUM:LTSJ:7D4B:VWES:DLEL
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 23
 Goroutines: 32
 System Time: 2018-06-26T10:22:08.783714835Z
 EventsListeners: 1
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Additional environment details (AWS, VirtualBox, physical, etc.):

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