Skip to content

Limit a containers memory and cpu #7

@Pold87

Description

@Pold87

See https://www.alibabacloud.com/help/doc-detail/26017.htm for mem_limit and cpu_shares for Docker Compose version 2. Docker Compose version 3 needs swarm to do that.

cpu_shares 100 means 1 full CPU, if you have 4 cores, you can, therefore, set it to 400.

To check how much CPU/memory a container is actually using, run:
sudo docker stats $(docker ps -lq) (maybe there's a better command, something with inspect).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions