Balic命令行Linux容器工具集

balic的Python项目详细描述


Balič(阅读balitch)是一个用于处理LXC容器的命令行工具集。在

PyPI - LicensePyPI - Downloads
PyPI - StatusPyPI - FormatPyPI - Wheel
PyPI - VersionPyPI - Python VersionsPyPI - Implementation
coverage.io report

安装

通过pip安装balic

pip install balic

Balic需要安装以下软件包:

^{pr2}$

使用

创建新容器:

# create a new lxc container called test
balic create -n test

生成设置:

# create test build directory
mkdir test

# create build.sh that echos hello world inside the container
echo 'echo "hello world"' > test/build.sh

# copy test directory into the container and run build.sh
balic build -n test -d test

如果需要在生成目录中准备任何内容:

# create prepare.sh which will be executed locally to prepare build dir
echo 'echo "prepare something inside build dir: `dirname "$0"`"' > test/prepare.sh

# run prepare.sh in given build dir
balic prepare -n test -d test

也可以进行多步骤构建:

# create test_step2 build directory
mkdir test_step2

# create build.sh that echos "another step" inside the container
echo 'echo "another step"' > test_step2/build.sh

# copy test directory into container and run build.sh
balic build -n test -d test_step2

包装已构建的容器:

# pack test lxc container into rootfs.tar.gz
balic pack -n test -o rootfs.tar.gz

不再需要时销毁容器:

# destroy test lxc container
balic destroy -n test

完整工作流程:

balic create -n test                 # creates lxc container names test
balic prepare -n test -d build_dir   # run prepare.sh inside the build_dir
balic build -n test -d build_dir     # builds test lxc container using content of build_dir
balic build -n test -d build_dir2    # builds test lxc container using content of build_dir2
balic build -n test -d build_dir3    # builds test lxc container using content of build_dir3
...
balic pack -n test -o rootfs.tar.gz  # packs test lxc container into rootfs.tar.gz
balic destroy -n test                # destroy test lxc container

buildprepare命令使用environment输入参数:

# to run `build.sh environment` or `prepare.sh environment` use -e input parameter
balic prepare -n test -d test -e production
balic build -n test -d test -e production

也就是说,您指定为environment的任何内容都将在build.sh/prepare.sh中的$1。在

文件

文件来源可在Balic储存库中找到 https://gitlab.com/markuz/balic/tree/master/docs/source

发展

欢迎拉取请求。在

Balicgit存储库位于https://gitlab.com/markuz/balic

有关详细信息,请参见https://gitlab.com/markuz/balic/-/blob/master/docs/source/development.rst

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
交换数组中重复值的位置(Java)   java搜索使用百分比匹配Elasticsearch SpringBoot中的文本   java Spring JPA和按输入字段排序   java我在输入CSV时出错了   java如何在RecyclerView中精确显示5项   使用java安全吗。util。servlet中的计时器?   使用Cp1252编码的java比较字符串   javafx打包java桌面应用程序,并引用开源许可证   java Spring和Camel CXF在战争中表现出色   java当EJB客户端失去与应用服务器的连接时,是否存在可以捕获的异常?   更改字符串值的java注释   java如何在sharedperfernce中保存自定义数组列表   RequestResponseLink:当使用java客户端读取队列时,Azure服务总线上RequestResponseLink到“$cbs”的内部发送链接因错误而关闭