memory관련 옵션
| 옵션(단위: bytes) | 의미 | 예 |
| -m, --memory | 메모리 제한 | # docker run -d -m 256m nginx |
| --memory-swap | 컨테이너의 swap 메모리 설정 memory + swap default: 기본 메모리 == 메모리의 2배 설정 |
#docker run -d -m 300m --memory-swap 500m nginx 실제 swap은 200m까지 가능 |
| --memory-reservation | 최소 xxx bytes까지는 보장 | #docker run -d -m 1g --memory-reservation 300m nginx |
| --oom-killi-disable | 프로세스가 OOM상태에서 프로세스를 kill하지 못하도록 함 | #docker run -d -m 200m --oom-kill-disable nginx |
CPU 제한
| 옵션(단위: core) | 의미 | 예 |
| --cpus | 컨테이너에 할달할 CPU core수 지정 | #docker run -d --cpus=".5" nginx |
| --cpuset-cpus | 컨테이너가 사용할 수 있는 CPU core할당 해당 core range에서 동작할 수 있게 지정 |
#docker run -d --cpuset-cpus 0-3 nginx |
| --cpu-share | 전체 CPU에서 비중을 지정 default: 1024 |
#docker run -d --cpu-share 2048 nginx |
Block IO 제한
| 옵션 | 의미 | 예 |
| --blkio-weight --blkio-weight-device |
block IP weight를 지정(10~1000) default: 500 |
#docker run -it --rm --blkio-weight 100 ubunbu /bin/bash |
| --device-read-bps --device-write-bps |
초당 read/write 설정 |
#docker run -it --rm --device-read-bps /dev/vda:1mb ubunbtu /bin/bash #docker run -it --rm --device-write-bps /dev/vda:10mb ubuntu /bin/bash |
| --device-read-iops --device-write-iops |
컨테이너의 read/write 속도 쿼터 설정 | #docker run -it --rm --device-read-iops /dev/vda:10 ubuntu /bin/bash #docker run -it --rm --device-write-iops /dev/vda:10 ubuntu /bin/bash |
docker host에서 container 리소스 확인

- 위치 /sys/fs/cgroup/memory/docker/container hash값/
docker stats

- # docker stats
cAdvisor를 통한 리소스모니터링

https://github.com/google/cadvisor
GitHub - google/cadvisor: Analyzes resource usage and performance characteristics of running containers.
Analyzes resource usage and performance characteristics of running containers. - GitHub - google/cadvisor: Analyzes resource usage and performance characteristics of running containers.
github.com

'클라우드 > Docker' 카테고리의 다른 글
| Docker network (0) | 2021.08.17 |
|---|---|
| Container volume (0) | 2021.08.15 |
| Docker registry (0) | 2021.08.11 |
| Docker image 생성 및 테스트 (0) | 2021.08.11 |
| Docker 명령어 테스트 (0) | 2021.08.11 |