blog:https://www.cnblogs.com/Rohn/
目錄
- 容器操作
- 列出容器
- 獲取容器/鏡像的元資料
- 查看容器中運行的行程資訊
- 獲取事件
- 獲取日志
- 阻塞運行
- 匯出容器
- 埠映射
- 顯示資源使用
容器操作
docker ps:列出容器;docker inspect:獲取容器/鏡像的元資料;docker top:查看容器中運行的行程資訊;docker events:從服務器獲取實時事件;docker logs:獲取容器的日志;docker wait:阻塞運行直到容器停止,然后列印出它的退出代碼;docker export:將檔案系統作為一個tar歸檔檔案匯出到STDOUT;docker port:列出指定的容器的埠映射,或者查找將PRIVATE_PORTNAT到面向公眾的埠;docker stats:顯示容器資源使用情況統計資訊的實時流;
列出容器
語法如下:
docker ps [OPTIONS]
Options:
-a, --all Show all containers (default shows just running)
-f, --filter filter Filter output based on conditions provided
--format string Pretty-print containers using a Go template
--help Print usage
-n, --last int Show n last created containers (includes all states) (default -1)
-l, --latest Show the latest created container (includes all states)
--no-trunc Don't truncate output
-q, --quiet Only display numeric IDs
-s, --size Display total file sizes
獲取容器/鏡像的元資料
語法如下:
docker inspect [OPTIONS] NAME|ID [NAME|ID...]
Options:
-f, --format string Format the output using the given Go template
--help Print usage
-s, --size Display total file sizes if the type is container
--type string Return JSON for specified type
查看容器中運行的行程資訊
語法如下:
docker top CONTAINER [ps OPTIONS]
獲取事件
語法如下:
docker events [OPTIONS]
Options:
-f, --filter filter Filter output based on conditions provided
--format string Format the output using the given Go template
--since string Show all events created since timestamp
--until string Stream events until this timestamp
獲取日志
語法如下:
docker logs [OPTIONS] CONTAINER
Options:
--details Show extra details provided to logs
-f, --follow Follow log output
--since string Show logs since timestamp
--tail string Number of lines to show from the end of the logs (default "all")
-t, --timestamps Show timestamps
阻塞運行
語法如下:
docker wait CONTAINER [CONTAINER...]
匯出容器
語法如下:
docker export [OPTIONS] CONTAINER
Options:
-o, --output string Write to a file, instead of STDOUT
埠映射
語法如下:
docker port CONTAINER [PRIVATE_PORT[/PROTO]]
顯示資源使用
語法如下:
docker stats [OPTIONS] [CONTAINER...]
Options:
-a, --all Show all containers (default shows just running)
--format string Pretty-print images using a Go template
--no-stream Disable streaming stats and only pull the first result
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/36173.html
標籤:Linux
下一篇:Ubuntu 安裝失敗
