Distcc in docker causing memory leaks

I want to use distcc inside docker to compile c++ but there are huge memory leaks. And the used memory is never free, even if I stop the container or the docker daemon.

I’m using this Dockerfile with Tini:

  • Starting a barebones MVC C# ASP.NET project in Docker gives “Compilation Error”
  • Can I run existing ASP.NET MVC application in Docker without converting to ASP.NET Core in Linux
  • Process window not proceeding after reader.ReadLine()
  • Is there any efficient way get the left physical memory in docker?
  • In microservice, how do you make sure that all services get updated when more than one micro service is affected?
  • c#/Mono solution not building on remote Dokku server
  • FROM fedora:24
    RUN dnf install -y wget \
        gnupg \
        distcc-server \
        gcc-c++ && \
        dnf clean packages
    RUN useradd distcc
    # grab tini for signal processing and zombie killing
    RUN set -x \
        && wget -O /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/$TINI_VERSION/tini" \
        && wget -O /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/$TINI_VERSION/tini.asc" \
        && export GNUPGHOME="$(mktemp -d)" \
        && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 6380DC428747F6C393FEACA59A84159D7001A4E5 \
        && gpg --batch --verify /usr/local/bin/tini.asc /usr/local/bin/tini \
        && rm -r "$GNUPGHOME" /usr/local/bin/tini.asc \
        && chmod +x /usr/local/bin/tini \
        && tini -h
    COPY docker-entrypoint.sh /
    EXPOSE 3632
    ENTRYPOINT ["/docker-entrypoint.sh"]

    And this entrypoint script:

    set -e
    set -- tini distccd -- "$@"
    exec "$@"

    My container starts well on my server:

    docker run -d -p 3632:3632 mydistcc --no-detach -a --verbose --log-stderr --jobs 8

    When I try to build any c++ repo from my workstation using my distcc server, the container will leak memory during the compilation. For example I’ve tried compiling OpenCV which leaks 1G per from scratch build:

    $ git clone https://github.com/opencv/opencv.git
    $ mkdir opencv/build && cd opencv/build
    $ DISTCC_HOSTS="mydistcc-server-ip/8" CXX="distcc g++" cmake ..
    $ DISTCC_HOSTS="mydistcc-server-ip/8" CXX="distcc g++" make -j 8

    If I run distcc-server natively on my server (without docker) I do not have any leak.

    What am I doing wrong with docker?

    Here is the docker info on my server:

    Containers: 0
     Running: 0
     Paused: 0
     Stopped: 0
    Images: 11
    Server Version: 1.10.3
    Storage Driver: devicemapper
     Pool Name: docker-253:0-2885180-pool
     Pool Blocksize: 65.54 kB
     Base Device Size: 10.74 GB
     Backing Filesystem: xfs
     Data file: /dev/loop0
     Metadata file: /dev/loop1
     Data Space Used: 4.514 GB
     Data Space Total: 107.4 GB
     Data Space Available: 42.87 GB
     Metadata Space Used: 5.03 MB
     Metadata Space Total: 2.147 GB
     Metadata Space Available: 2.142 GB
     Udev Sync Supported: true
     Deferred Removal Enabled: false
     Deferred Deletion Enabled: false
     Deferred Deleted Device Count: 0
     Data loop file: /var/lib/docker/devicemapper/devicemapper/data
     WARNING: Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt
    dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
     Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
     Library Version: 1.02.122 (2016-04-09)
    Execution Driver: native-0.2
    Logging Driver: journald
     Volume: local
     Network: bridge null host
    Kernel Version: 4.8.13-200.fc24.x86_64
    Operating System: Fedora 24 (Workstation Edition)
    OSType: linux
    Architecture: x86_64
    Number of Docker Hooks: 2
    CPUs: 8
    Total Memory: 23.53 GiB
    Name: myserver
    Registries: docker.io (secure)

  • Is it possible to run linux docker image on windows
  • Possible to http clone repo to Docker Container?
  • Docker LVM thinpool meta data sizing
  • 'docker ps' hangs forever after server restart
  • Cannot execute ansible playbook via docker container
  • how to automate docker development environment startup for a multi-service web app (on Linux)
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.