--- id: dockerfile-parse version: "2.0.1" license: BSD license_treatment: permissive maintenance: dormant --- # dockerfile-parse — Python library for Dockerfile manipulation License: permissive · Maintenance: dormant · Downloads: 11.6M/mo ## What it is and what it does dockerfile-parse is a Python library that reads and parses Dockerfile files into a structured representation, exposing properties like base image, labels, and user directives for programmatic inspection and modification. It has no runtime dependencies and supports Python 3.6 through 3.11, making it lightweight to integrate into build tooling, container orchestration systems, or CI/CD pipelines that need to reason about or rewrite Dockerfiles. The library is in Production/Stable status and has been maintained since 2015, though recent activity is minimal. It is suitable for tasks like extracting metadata from Dockerfiles, validating structure, or generating modified versions with updated base images or labels. The permissive BSD license allows use in both open and closed projects. Use it for: - Extract base image, labels, and user directives from existing Dockerfiles for inventory or compliance auditing - Programmatically update a Dockerfile's base image across a fleet of build configurations - Validate Dockerfile structure and syntax before passing it to a build system - Generate or transform Dockerfiles in build automation tools that need to inject environment variables or change layers ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses and manipulates Dockerfile files programmatically, allowing you to read, analyze, and modify Dockerfile structure and content through a Python API. Yes, if you need to parse or modify Dockerfiles in Python code. Low install friction, no dependencies, and stable API make it a straightforward choice for build tooling. Dormant maintenance is acceptable for a mature, narrow-scope library, but verify that its parser handles your target Dockerfile syntax before committing to it in a critical pipeline. ## Install pip install dockerfile-parse uv add dockerfile-parse poetry add dockerfile-parse ## Installing dockerfile-parse Before you install: Low install friction with no runtime dependencies. Maintenance is dormant—last release was 2023-07-18 and no commits since 2024-08-12—but the package is marked Production/Stable and has been in use since 2015, so it is unlikely to require active development. License in practice: BSD license is permissive, allowing commercial and private use with minimal restrictions; you must include a copy of the license and copyright notice. Quickstart: pip install dockerfile-parse from dockerfile_parse import DockerfileParser dfp = DockerfileParser() dfp.content = "FROM base\nLABEL foo=\"bar\"\nUSER me" print(dfp.baseimage) dfp.baseimage = 'centos:7' print(dfp.content) Verify before relying: - Whether the parser handles all Dockerfile syntax variations and edge cases introduced in recent Docker versions - Whether dormant maintenance poses a risk if Docker's Dockerfile format evolves significantly ## Package facts - License: BSD (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 11.6M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags dockerfile parsing, parse dockerfile python, dockerfile manipulation, read dockerfile structure, dockerfile analysis library, modify dockerfile content, dockerfile ast parser, dockerfile, container-build, parsing [View on SkillFed](https://skillfed.io/packages/dockerfile-parse) · [View on PyPI](https://pypi.org/project/dockerfile-parse/)