ユーザ用ツール

サイト用ツール


サイドバー

このページの翻訳:



最近の更新



Tag Cloud

06_virtualization:05_container:07_docker_memory_limit

文書の過去の版を表示しています。


07 Docker Memory Limit

docker-compose ver 2

version: '2'
  node-exporter:
    image: prom/node-exporter
    container_name: node-exporter
    ports:
      - 9100:9100
    restart: always
    mem_limit: 100m

docker-compose ver 3

version: '3'

  node-exporter:
    image: prom/node-exporter
    container_name: node-exporter
    ports:
      - 9100:9100
    restart: always
    deploy:
      resources:
        limits:
          memory: 100m

Error

普通にup -d 行うとサポートしてないというWERNINGが出てメモリの制限できない

$ docker-compose up -d
WARNING: Some services (nginx) use the 'deploy' key, which will be ignored. Compose does not support 'deploy' configuration - use `docker stack deploy` to deploy to a swarm.

対応

「–compatibility」を付けるとversion 3でもメモリ制限可能
ただ本番利用では、compatibilityは非推奨になっているようです。

$ docker-compose --compatibility up -d
06_virtualization/05_container/07_docker_memory_limit.1626561081.txt.gz · 最終更新: 2021/07/18 07:31 by matsui