Docker rm/start/stopコマンド
目次
docker rm
コンテナを削除します。
Shell
# docker rm cont1
-f (--force) オプションをつけると、コンテナが起動中であっても削除することが可能となります。
Shell
# docker rm -f cont1
-v (--volume) オプションは、docker run によるコンテナ作成時に -v で作成したボリュームも同時に削除します。ただし、名前付きのボリュームやパス名を指定したディレクトリは削除しません。
Shell
# docker run -d -it --name cont1 -v /disk1 centos:7 # docker rm -v cont1 # docker volume ls
docker start
コンテナを開始します。
Shell
# docker start cont1
docker stop
コンテナを比較的安全に停止します。具体的には、コンテナプロセスに対して SIGTERM を送信後、10秒後に強制停止します。
Shell
# docker stop cont1
docker kill
コンテナを強制的に停止します。具体的には、コンテナプロセスに対して即座に SIGKILL を送信します。
Shell
# docker kill cont1
docker restart
コンテナを再起動します。
Shell
# docker restart cont1
docker pause
コンテナ内のプロセスを一時停止します。以前は SIGKILL を送信していましたが、現在は cgroups を凍結(freezer)しています。
Shell
# docker restart cont1
docker unpause
コンテナの一時停止を解除します。
Shell
# docker unpause cont1
リンク
- http://docs.docker.jp/engine/reference/commandline/rm.html
- http://docs.docker.jp/engine/reference/commandline/start.html
- http://docs.docker.jp/engine/reference/commandline/stop.html
- http://docs.docker.jp/engine/reference/commandline/kill.html
- http://docs.docker.jp/engine/reference/commandline/restart.html
- http://docs.docker.jp/engine/reference/commandline/pause.html
- http://docs.docker.jp/engine/reference/commandline/unpause.html
Copyright (C) 2019 杜甫々
初版:2019年9月1日 最終更新:2019年9月1日
https://www.tohoho-web.com/docker/docker_start.html