Linux command
docker-container-update 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Update CPU limit
docker container update --cpus [2] [container]
Update memory limit
docker container update --memory [512m] [container]
Update restart policy
docker container update --restart [always] [container]
Update multiple containers
docker container update --memory [1g] [container1] [container2]
说明
docker container update dynamically updates resource constraints and restart policies for one or more running containers without requiring a restart. This allows administrators to adjust resource limits in response to changing workload requirements or to correct initial configuration mistakes. While most resource limit changes take effect immediately, some settings may require a container restart to fully apply. The restart policy update is particularly useful for changing whether containers should automatically restart on failure or system boot.
参数
- --cpus _decimal_
- Number of CPUs.
- --memory -m _bytes_
- Memory limit.
- --memory-swap _bytes_
- Swap limit.
- --restart _policy_
- Restart policy (no, on-failure, always, unless-stopped).
- --cpu-shares _int_
- CPU shares (relative weight).
- --cpu-period _int_
- Limit CPU CFS (Completely Fair Scheduler) period.
- --cpu-quota _int_
- Limit CPU CFS quota.
- --cpuset-cpus _string_
- CPUs in which to allow execution (e.g., 0-3, 0,1).
- --cpuset-mems _string_
- MEMs in which to allow execution (0-3, 0,1).
- --memory-reservation _bytes_
- Memory soft limit.
- --kernel-memory _bytes_
- Kernel memory limit (deprecated).
- --blkio-weight _uint16_
- Block IO (relative weight), between 10 and 1000, or 0 to disable.
- --pids-limit _int_
- Tune container pids limit (set -1 for unlimited).
FAQ
What is the docker-container-update command used for?
docker container update dynamically updates resource constraints and restart policies for one or more running containers without requiring a restart. This allows administrators to adjust resource limits in response to changing workload requirements or to correct initial configuration mistakes. While most resource limit changes take effect immediately, some settings may require a container restart to fully apply. The restart policy update is particularly useful for changing whether containers should automatically restart on failure or system boot.
How do I run a basic docker-container-update example?
Run `docker container update --cpus [2] [container]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --cpus _decimal_ do in docker-container-update?
Number of CPUs.