Docker技巧-限制CPU,内存使用

date
May 24, 2022
slug
tip-docker-limit-cpu-memory-use
status
Published
summary
小技巧
tags
tip
docker
type
Post
URL

Problem & Summary

    Solution

    • docker 用 —cpus=”.5” 来限制
    docker run -it --cpus=".5" ubuntu /bin/bash
    
    # 和environment
    services:
      app:
        image:
        container_name:
        restart: unless-stopped
        ports:
        environment:
        deploy:
          resources:
            limits:
              cpus: '0.5'
              #memory: 50M
            reservations:
              cpus: '0.1'
              #memory: 20M
    notion image

    Screenshots

     

    © Ying Bun 2021 - 2024