Skip to content

Docker tries to use wrong cgroups memory limits. #20603

Closed

Description

@dbalakirev

I am running OpenShift Origin 1.1.3, and when it tries to create a docker container it fails as follows:
F0223 10:49:18.586144 1 builder.go:204] Error: build error: API error (500): Cannot start container ebe398c8e664713a08abeaefe7214025fce51f173ca9256eb9f1da7fb7c3451b: [9] System error: write /sys/fs/cgroup/memory/docker/ebe398c8e664713a08abeaefe7214025fce51f173ca9256eb9f1da7fb7c3451b/memory.limit_in_bytes: invalid argument

The value in the mentioned file: 9223372036854775807

My assumption was that I should configure the values on the docker category level, so I edited /sys/fs/cgroup/memory/docker/memory.limit_in_bytes. The new value I gave is 4G, which then turned automatically to 4294967296.

Restarted docker service and openshift, hoping the category level would be used for the new container but that is not the case. Same result.

Now in the docker cgroup category there are quite a few files with the mentioned limit (9223372036854775807), but I honestly don't know which one will be used.

Frankly I also don't know if the error means the value is too low, or too high.

I am using RHEL 7.1, and docker-engine version 1.10.2.

I am trying to figure out how cgroups should work from the RHEL docs [1], while I hope somebody else could point out the problem.

[1] https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/sec-memory.html

root@mymachine:~# docker info
Containers: 73
Running: 2
Paused: 0
Stopped: 71
Images: 18
Server Version: 1.10.1
Storage Driver: devicemapper
Pool Name: docker-253:1-1188491-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: 3.722 GB
Data Space Total: 107.4 GB
Data Space Available: 21.01 GB
Metadata Space Used: 8.491 MB
Metadata Space Total: 2.147 GB
Metadata Space Available: 2.139 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.107-RHEL7 (2015-12-01)
Execution Driver: native-0.2
Logging Driver: json-file
Plugins:
Volume: local
Network: host bridge null
Kernel Version: 3.10.0-327.10.1.el7.x86_64
Operating System: Red Hat Enterprise Linux Workstation 7.2 (Maipo)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.633 GiB
Name: ...
ID: HJ7W:TMSQ:X6FP:5GXJ:SG6W:FCOX:S4HI:KOEI:P5CI:P3SA:Y4ZU:PKQL
...
...
WARNING: bridge-nf-call-ip6tables is disabled

Activity

  1. GordonTheTurtle commented on Feb 23, 2016

    @GordonTheTurtle
    Contributor

    If you are reporting a new issue, make sure that we do not have any duplicates already open. You can ensure this by searching the issue list for this repository. If there is a duplicate, please close your issue and add a comment to the existing issue instead.

    If you suspect your issue is a bug, please edit your issue description to include the BUG REPORT INFORMATION shown below. If you fail to provide this information within 7 days, we cannot debug your issue and will close it. We will, however, reopen it if you later provide the information.

    For more information about reporting issues, see CONTRIBUTING.md.

    You don't have to include this information if this is a feature request

    (This is an automated, informational response)


    BUG REPORT INFORMATION

    Use the commands below to provide key information from your environment:

    docker version:
    docker info:

    Provide additional environment details (AWS, VirtualBox, physical, etc.):

    List the steps to reproduce the issue:
    1.
    2.
    3.

    Describe the results you received:

    Describe the results you expected:

    Provide additional info you think is important:

    ----------END REPORT ---------

    #ENEEDMOREINFO

  2. dbalakirev commented on Feb 23, 2016

    @dbalakirev
    Author

    Okay, so after more digging it seems to be related to #18087.

    I tried out outside of openshift with a 'regular' docker container and then the proper values are propagated to the container if --memory is used.

    @phemmer mentioned that this is driven by the kernel if --memory is not used.

    I guess I should see if I can control memory settings for the containers from openshift (if I can) and close this ticket.

    TLDR:

    docker run -it ubuntu
    ...
    cat .../memory.limit_in_bytes
    9223372036854775807

    docker run -it --memory=2G ubuntu
    ...
    cat .../memory.limit_in_bytes
    2147483648

    Value 9223372036854775807 I assume is the possible maximum, set by the kernel in /sys/fs/cgroup/memory/memory.limit_in_bytes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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