dockerfile
Parse a dockerfile into a high-level representation using the official go parser.
Decision gist · record as of 2026-08-14
Yes, if you need reliable Dockerfile parsing and can accept that the package is archived. The MIT license is permissive, install friction is manageable with prebuilt wheels, and there are no known vulnerabilities. However, be aware that the repository is no longer maintained—if Docker's parser evolves significantly or you encounter edge cases, upstream fixes are unlikely. For new projects, verify that the parsing behavior matches your current Docker version.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >= 3.9.
- Building from source requires a Go compiler; prebuilt wheels are available for Linux x86_64, macOS (x86_64 and ARM64), and Windows x64.
- Medium install friction due to compiled extension (requires Go compiler when building from source), but prebuilt wheels are available for common platforms.
License · maintenance · safety
MIT (permissive) — MIT license is permissive and poses no restrictions on commercial or private use, modification, or redistribution.
last release 2025-01-04 (587 days) · last repo commit 2025-01-20 · 105 stars · archived
0 known vulnerabilities (OSV.dev, 2026-08-14) · 358,768 downloads/mo, #7,260 on PyPI
Alternatives
Verify before relying
pip install dockerfile
import dockerfile
cmds = dockerfile.parse_file('Dockerfile')
for cmd in cmds:
print(cmd.cmd, cmd.value)- Whether the archived repository will continue to receive security updates or bug fixes if Docker's parser changes significantly.
- Performance characteristics when parsing very large or complex Dockerfiles.
What it is and what it does
dockerfile is a Python wrapper around Docker's official Dockerfile parser, written in Go. It exposes three main functions: all_cmds() lists valid Dockerfile commands, parse_file() parses a Dockerfile from disk, and parse_string() parses Dockerfile syntax from a string. Each returns a tuple of Command objects with structured fields (cmd, sub_cmd, json flag, original text, line number, flags, and parsed values).
The package is useful for tools that need to analyze or manipulate Dockerfile content programmatically. It has no runtime dependencies and handles parsing errors with specific exception types (GoIOError for file access, GoParseError for syntax). The repository is now archived and unmaintained, though it remains functional for current Python versions.
Use it for
- Analyze Dockerfile structure in CI/CD pipelines to validate layer counts, base images, or security patterns.
- Extract environment variables, exposed ports, or entrypoint commands from Dockerfiles for documentation or compliance scanning.
- Build linting or static analysis tools that inspect Dockerfile syntax and report violations.
- Programmatically modify or generate Dockerfiles by parsing existing ones and reconstructing them with changes.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need reliable Dockerfile parsing and can accept that the package is archived.
The MIT license is permissive, install friction is manageable with prebuilt wheels, and there are no known vulnerabilities. However, be aware that the repository is no longer maintained—if Docker's parser evolves significantly or you encounter edge cases, upstream fixes are unlikely. For new projects, verify that the parsing behavior matches your current Docker version.
Install
dockerfile on PyPI
Before you install
Medium install friction due to compiled extension (requires Go compiler when building from source), but prebuilt wheels are available for common platforms. Repository is archived and unmaintained as of 587 days since last release, though the latest version was released on 2025-01-04.
Requires Python >= 3.9. Building from source requires a Go compiler; prebuilt wheels are available for Linux x86_64, macOS (x86_64 and ARM64), and Windows x64.
License in practice
MIT license is permissive and poses no restrictions on commercial or private use, modification, or redistribution.
Quickstart
pip install dockerfile
import dockerfile
cmds = dockerfile.parse_file('Dockerfile')
for cmd in cmds:
print(cmd.cmd, cmd.value)
Verify before relying
- Whether the archived repository will continue to receive security updates or bug fixes if Docker's parser changes significantly.
- Performance characteristics when parsing very large or complex Dockerfiles.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Abandoned 587 days since the last release |
| Last repo commit | repository archived |
| First released | |
| Downloads | 358,768 / month, #7,260 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy |
Evidence: dockerfile-3.4.0-cp39-abi3-macosx_13_0_x86_64.whl; dockerfile-3.4.0-cp39-abi3-macosx_14_0_arm64.whl; dockerfile-3.4.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl; dockerfile-3.4.0-cp39-abi3-win_amd64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “dockerfile parser python”
- dockerfileParses Dockerfile syntax into structured Python objects using the…
- dockerfile-parseParses and manipulates Dockerfile files programmatically, allowing…
- hadolint-coatlProvides a pip-installable hadolint binary wrapper that makes the…
Give your agent the search over MCP, or paste the wish link into any chat.
More Build Tools packages
Provides reusable utilities for Python packaging interoperability, including version handling, specifiers, markers, requirements, tags, and metadata parsing according to standards like PEP 440 and PEP 425.
Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.
pip is the standard installer for Python packages, enabling you to download and install packages from the Python Package Index and other indexes into your Python environment.
Hatchling is a standards-compliant Python build backend that handles packaging, metadata, and distribution of Python projects when configured in a project's pyproject.toml file.
Generates Python gRPC service stubs and message classes from Protocol Buffer definitions, enabling developers to build gRPC clients and servers.
pre-commit is a framework for installing and running git hooks written in any language before commits are made, automating code quality and validation checks across multi-language projects.
Install it if your team needs consistent, automated validation at commit time.
See also container-inspector · dockerfile-parse · tox-docker · python-on-whales · ast-serialize · hadolint-coatl · flexparser · bashlex · setuptools-golang · git-url-parse