--- id: dockerfile version: "3.4.0" license: MIT license_treatment: permissive maintenance: abandoned --- # dockerfile — Parse a dockerfile into a high-level representation using the official go parser. License: permissive · Maintenance: abandoned · Downloads: 358.8K/mo ## 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 above — verify before relying. Parses Dockerfile syntax into structured Python objects using the official Docker parser, exposing commands, flags, and values for programmatic inspection. 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 pip install dockerfile uv add dockerfile poetry add dockerfile ## Installing dockerfile 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. 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) 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. 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_current - Install friction: medium - Maintenance: abandoned - Downloads: 358.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags dockerfile parser python, parse dockerfile syntax, docker container definition analysis, dockerfile command extraction, dockerfile ast representation, docker build file parsing, containerfile syntax analysis, dockerfile-parsing, docker-tooling, archived [View on SkillFed](https://skillfed.io/packages/dockerfile) · [View on PyPI](https://pypi.org/project/dockerfile/)