跳转到主要内容

用于操作Dockerfile的Python库

项目描述

dockerfile-parse

unittests status badge coveralls status badge lgtm python badge lgtm alerts badge linters status badge

解析Dockerfile文件的Python库。

安装

从PyPI

pip install dockerfile-parse

从git

克隆此git存储库并使用python安装程序进行安装

git clone https://github.com/containerbuildsystem/dockerfile-parse.git
cd dockerfile-parse
sudo pip install .

用法

from pprint import pprint
from dockerfile_parse import DockerfileParser

dfp = DockerfileParser()
dfp.content = """\
From  base
LABEL foo="bar baz"
USER  me"""

# Print the parsed structure:
pprint(dfp.structure)
pprint(dfp.json)
pprint(dfp.labels)

# Set a new base:
dfp.baseimage = 'centos:7'

# Print the new Dockerfile with an updated FROM line:
print(dfp.content)

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源代码分发

dockerfile-parse-2.0.1.tar.gz (24.6 kB 查看哈希值)

上传时间 源代码

构建分发

dockerfile_parse-2.0.1-py2.py3-none-any.whl (14.8 kB 查看哈希值)

上传时间 Python 2 Python 3

由以下支持