← 返回命令列表

Linux command

docker-update 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Update CPU limit

docker update --cpus [2] [container]

Update memory limit

docker update --memory [512m] [container]

Update restart policy

docker update --restart [always] [container]

Update multiple containers

docker update --memory [1g] [container1] [container2]

Remove memory limit

docker update --memory [0] [container]

说明

docker update dynamically updates container resource constraints. Allows changing CPU, memory, and restart settings without recreating the container. Can update running or stopped containers. Not supported for Windows containers.

参数

--cpus _decimal_
Number of CPUs.
--memory, -m _bytes_
Memory limit.
--memory-swap _bytes_
Swap limit (-1 for unlimited).
--restart _string_
Restart policy (no, on-failure, always, unless-stopped).
--cpu-shares _int_
CPU shares (relative weight).
--memory-reservation _bytes_
Memory soft limit.
--cpuset-cpus _string_
CPUs in which to allow execution (e.g., 0-3, 0,1).
--pids-limit _int_
Tune container pids limit (-1 for unlimited).
--blkio-weight _uint16_
Block IO relative weight (10-1000), 0 to disable.
--cpu-period _int_
Limit CPU CFS period (microseconds).
--cpu-quota _int_
Limit CPU CFS quota (microseconds).

FAQ

What is the docker-update command used for?

docker update dynamically updates container resource constraints. Allows changing CPU, memory, and restart settings without recreating the container. Can update running or stopped containers. Not supported for Windows containers.

How do I run a basic docker-update example?

Run `docker 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-update?

Number of CPUs.