Docker cp/rename/updateコマンド
目次
docker cp
docker cp は、コンテナからホストへ、または、ホストからコンテナへファイルやディレクトリをコピーします。
Shell
# docker run -d -it --name cont1 centos:7 # docker cp ./file1.txt cont1:/tmp ホストからコンテナにコピー # docker cp cont1:/tmp/file2.txt . コンテナからホストにコピー
ディレクトリをコピーすることもできます。
Shell
# docker cp cont1:/var/log/httpd .
docker rename
コンテナ名を変更します。
Shell
# docker run -d -it --name cont1 centos:7 # docker rename cont1 cont2 # docker ps
docker update
コンテナのCPU数、メモリ上限などの値を変更します。
Shell
# docker update -m 500M --memory-swap 500M cont1
変更可能な値は --help を参照してください。
Shell
# docker update --help
Usage: docker update [OPTIONS] CONTAINER [CONTAINER...]
Update configuration of one or more containers
Options:
--blkio-weight uint16 Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)
--cpu-period int Limit CPU CFS (Completely Fair Scheduler) period
--cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota
--cpu-rt-period int Limit the CPU real-time period in microseconds
--cpu-rt-runtime int Limit the CPU real-time runtime in microseconds
-c, --cpu-shares int CPU shares (relative weight)
--cpus decimal Number of CPUs
--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)
--kernel-memory bytes Kernel memory limit
-m, --memory bytes Memory limit
--memory-reservation bytes Memory soft limit
--memory-swap bytes Swap limit equal to memory plus swap: '-1' to enable unlimited swap
--pids-limit int Tune container pids limit (set -1 for unlimited)
--restart string Restart policy to apply when a container exits
リンク
- http://docs.docker.jp/engine/reference/commandline/cp.html
- http://docs.docker.jp/engine/reference/commandline/rename.html
- http://docs.docker.jp/engine/reference/commandline/update.html
Copyright (C) 2019 杜甫々
初版:2019年9月1日 最終更新:2019年9月1日
https://www.tohoho-web.com/docker/docker_cp.html