Balic命令行Linux容器工具集
balic的Python项目详细描述
Balič(阅读balitch)是一个用于处理LXC容器的命令行工具集。在
安装
通过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
对build和prepare命令使用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
- 项目
标签: