Example usage in container

Open
#179 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Stale
Tech stack
go, linux

Research direction

Start with the reported cgroups.Load(cgroups.V1, cgroups.NestedPath("")) call, the /sys/fs/cgroup/memory/memory.limit_in_bytes path, and the os.Getpid() behavior described in the issue. Determine the supported way to use the library inside a running container, then document the required cgroup setup and expected result or limitation.

Written by the indexing model from the issue text.

Description

Hi,

sorry for creating an issue but I didn't know where to ask a quesiton.

Can this library be used in a running container to get cgroups memory limits? I would like to get value of /sys/fs/cgroup/memory/memory.limit_in_bytes. Probably it's not safe to read that file directly hence I would like to use this lib to get the memory_limit_in_bytes.

How should be the cgroups created?

control, err := cgroups.Load(cgroups.V1, cgroups.NestedPath("")) //always error

Creating it by PID does not work either as the os.Getpid() returns 1 in the container.

Dominant language
Go
Stars
1.2k
Forks
255
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from containerd/cgroups

All issues in containerd/cgroups

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.