「 操控docker容器的一个 Rust 接口 」
翻译的原文 | 与日期 | 最新更新 | 更多 |
---|---|---|---|
commit | ⏰ 2019-2-25 | 中文翻译 |
欢迎 👏 勘误/校对/更新贡献 😊 具体贡献请看
If help, buy me coffee —— 营养跟不上了,给我来瓶营养快线吧! 💰
操控docker容器的一个 Rust 接口
将以下内容添加到您的Cargo.toml
文件
[dependencies]
shiplift = "0.4"
要使用 shiplift,首先,您必须拥有一个可随时能用的 docker 守护程序。通常,此守护程序进程可通过名为DOCKER_HOST
的环境变量,指定 URL 解析。
let docker = shiplift::Docker::new();
如果您希望更明确,可用一种url.Url
形式提供一个主机。
use shiplift::Docker;
use url::Url;
let docker = Docker::host(Url::parse("http://yourhost").unwrap());
可以在此存储库中的示例目录,找到许多小的可运行示例程序。
- containers:容器 》列出当前 Docker 主机上的 Docker 镜像
- containercopyinto 》将字节切片作为文件复制到容器中(请参见“bytes”)。
- containercreate 》返回用于创建新容器实例的生成器接口
- containerdelete 》删除容器实例
- containerexec 》在容器中执行指定的命令
- containerinspect 》检查命名镜像的详细信息
- containercopyfrom 》从容器复制文件/文件夹。结果流是提取文件的压缩格式。
- images:镜像 》列出当前 Docker 主机上的 Docker 镜像
- imagepull 》从现有镜像中提取并创建新的 Docker 镜像
- imagesearch 》按术语搜索 Docker 镜像
- imagebuild 》通过读取目标目录中的 docker file 生成新的镜像 build
- imagedelete 》删除镜像
- imageinspect 》从现有镜像中提取并创建新的 Docker 镜像
- networks:网络 》列出当前 Docker 主机上的 Docker 镜像
- networkcreate 》返回用于创建新容器实例的生成器接口
- networkdisconnect 》断开容器与网络的连接
- networkinspect 》检查命名镜像的详细信息
- networkconnect 》将容器连接到网络
- networkdelete 》删除镜像
- volumes 》列出 Docker 卷
- volumecreate 》创建卷
- volumedelete 》删除卷
- give image pull chunked json a proper type
Doug Tangren(softprops)2015-2018