Posted at

備忘録: docker run で `--restart=always` を付け忘れたコンテナに後から `--restart=always` をつけるには

More than 1 year has passed since last update.

docker update をつかう

$ docker update --restart=always コンテナのID


他にも

Usage:  docker update [OPTIONS] CONTAINER [CONTAINER...]

Update configuration of one or more containers

Options:
--blkio-weight value Block IO (relative weight), between 10 and 1000
--cpu-period int Limit CPU CFS (Completely Fair Scheduler) period
--cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota
-c, --cpu-shares int CPU shares (relative weight)
--cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)
--cpuset-mems string MEMs in which to allow execution (0-3, 0,1)
--help Print usage
--kernel-memory string Kernel memory limit
-m, --memory string Memory limit
--memory-reservation string Memory soft limit
--memory-swap string Swap limit equal to memory plus swap: '-1' to enable unlimited swap
--restart string Restart policy to apply when a container exits

https://docs.docker.com/engine/reference/commandline/update/

メモリや CPU の soft limit など設定できる模様。