# View container cpu limits

**URL:** <https://forums.docker.com/t/view-container-cpu-limits/33944>\
**Category:** Compose\
**Created:** [June 22, 2017, 5:56pm UTC](https://forums.docker.com/t/view-container-cpu-limits/33944 "2017-06-22T17:56:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aalcamo](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/aalcamo/32/15415_2.png) [@aalcamo](https://forums.docker.com/u/aalcamo)\
**Post date:** [June 22, 2017, 5:56pm UTC](https://forums.docker.com/t/view-container-cpu-limits/33944/1 "2017-06-22T17:56:42Z")

</div>

docker version  
Client:  
Version: 17.03.2-ee-4  
API version: 1.27  
Go version: go1.7.5  
Git commit: 1e6d71e  
Built: Fri May 19 20:19:32 2017  
OS/Arch: linux/amd64

Server:  
Version: 17.03.2-ee-4  
API version: 1.27 (minimum version 1.12)  
Go version: go1.7.5  
Git commit: 1e6d71e  
Built: Fri May 19 20:19:32 2017  
OS/Arch: linux/amd64  
Experimental: false

**docker-compose.yml**  
version: ‘3’

services:  
apache:  
image: "registry.x.y.z/lob/product/apache:1.0-SNAPSHOT"  
tty: true  
ports:  
- “80:80”  
- "443:443"  
depends\_on:  
- node2  
networks:  
- my\_network  
deploy:  
replicas: 1  
resources:  
limits:  
memory: 4G  
cpus: “2.0”

I am attempting to perform a docker stack deploy and limit my container’s memory to 4G and maximum number of cpus to 2. The yaml file is above showing my syntax. When try to view the resource limits using docker stats, however, I am only able to see the maximum amount of memory allocated. i.e:  
**docker stats**  
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS  
adecb78a325e 0.00% 25.11 MiB / **4 GiB** 0.61% 1.3 kB / 1.94 kB 17.3 MB / 0 B 56  
I also installed cAdvisor, but it shows  
Isolation

```
CPU
Shares 1024 shares
Allowed Cores 0 1 2 3

Memory
Reservation unlimited
Limit 4.00 GB
Swap Limit 8.00 GB

```

Is my syntax incorrect?  
Is there a way to view the maximum number of cpus allocated to a container?  
Thank you,  
Anthony

---

<div class="post-metadata">

**Author:** ![sheogorath](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/sheogorath/32/4254_2.png) [@sheogorath](https://forums.docker.com/u/sheogorath)\
**Post date:** [July 16, 2017, 4:07pm UTC](https://forums.docker.com/t/view-container-cpu-limits/33944/2 "2017-07-16T16:07:40Z")

</div>

The setting is fine.

Keep in mind you are in a shared kernel so you will may see more than you can use, as the kernel shows you what is installed to the machine, not what is available to your process.

For more details check the official guide:

> **[Limit a container's resources](https://docs.docker.com/engine/admin/resource_constraints/#configure-the-default-cfs-scheduler)**
>
> By default, a container has no resource constraints and can use as much of a given resource as the host’s kernel scheduler will allow. Docker provides ways to control how...
