Docker Community Forums

Share and learn in the Docker community.

Docker container potential disk leakage

Hi all, I have experience a strange problem regarding docker. Here is some info:

OS:

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.6 LTS
Release:	16.04
Codename:	xenial
docker --version
Client:
 Version:           18.09.8
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        0dd43dd87f
 Built:             Wed Jul 17 17:41:19 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.8
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       0dd43dd
  Built:            Wed Jul 17 17:07:25 2019
  OS/Arch:          linux/amd64
  Experimental:     false

One of the container is using a lots of disk space

du -sh /var/lib/docker/containers/*
11G	/var/lib/docker/containers/0d53e60a089fc7358af962e5389ac8e39264dfa5f0d07d5ee8a5c6d65e0caa27
162M	/var/lib/docker/containers/12f60398017a381bbc8b86c17e45b75181e88faf5677596ca1cd58876a814fd1
139M	/var/lib/docker/containers/1deb795632456af9f2039f3e91edfa05aa67b3d07f0c3a3b22cca4af7859f8d8

However, I can’t seems to debug it

docker ps --size
CONTAINER ID        IMAGE                                                                      COMMAND                  CREATED             STATUS              PORTS               NAMES                                                        SIZE
0d53e60a089f        kybernetwork/limit-order-backend-monitoring-worker-user-info:master        "/cmd --mode product…"   2 weeks ago         Up 2 weeks                              kyber-limit-order-backend-monitoring-worker-user-info        17.6MB (virtual 141MB)
12f60398017a        kybernetwork/limit-order-backend-monitoring-worker-token-rate:master       "/cmd --mode product…"   2 weeks ago         Up 2 weeks                              kyber-limit-order-backend-monitoring-worker-token-rate       0B (virtual 124MB)
1deb79563245        kybernetwork/limit-order-backend-monitoring-worker-eligible-order:master   "/cmd --mode product…"   2 weeks ago         Up 2 weeks                              kyber-limit-order-backend-monitoring-worker-eligible-order   0B (virtual 124MB)

Here is du result after exec into the container

/var/lib/docker/containers# docker exec -it  kyber-limit-order-backend-monitoring-worker-user-info /bin/bash
root@0d53e60a089f:/# du -sh /*
5.1M	/bin
4.0K	/boot
15M	/cmd
0	/dev
1.5M	/etc
4.0K	/home
11M	/lib
4.0K	/lib64
4.0K	/media
4.0K	/mnt
4.0K	/opt
du: cannot access '/proc/246/task/246/fd/4': No such file or directory
du: cannot access '/proc/246/task/246/fdinfo/4': No such file or directory
du: cannot access '/proc/246/fd/4': No such file or directory
du: cannot access '/proc/246/fdinfo/4': No such file or directory
0	/proc
28K	/root
8.0K	/run
4.1M	/sbin
4.0K	/srv
0	/sys
4.0K	/tmp
91M	/usr
22M	/var

Here is my Dockerfile:

FROM debian:stretch

ARG MODULE
ARG SERVICE
COPY ./${MODULE}/cmd/${SERVICE}/${SERVICE} /cmd

RUN apt-get update && \
    apt-get install -y ca-certificates && \
    rm -rf /var/lib/apt/lists/*

ENTRYPOINT [ "/cmd" ]

cmd is an executable build by go which run and produce log to stdout. There is no volume.

So my question is:

  1. How can I debug it?
  2. What is the problem that can cause this unusual disk usage?

Thanks in advanced!