Skip to main content

Python library for Dockerfile manipulation

Project description

dockerfile-parse

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

Python library for parsing Dockerfile files.

Installation

From PyPI

pip install dockerfile-parse

From git

Clone this git repo and install using the python installer

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

Usage

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dockerfile-parse-2.0.1.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

dockerfile_parse-2.0.1-py2.py3-none-any.whl (14.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file dockerfile-parse-2.0.1.tar.gz.

File metadata

  • Download URL: dockerfile-parse-2.0.1.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for dockerfile-parse-2.0.1.tar.gz
Algorithm Hash digest
SHA256 3184ccdc513221983e503ac00e1aa504a2aa8f84e5de673c46b0b6eee99ec7bc
MD5 323d2d89cca3ed346b0204fd00562a0d
BLAKE2b-256 92df929ee0b5d2c8bd8d713c45e71b94ab57c7e11e322130724d54f469b2cd48

See more details on using hashes here.

File details

Details for the file dockerfile_parse-2.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for dockerfile_parse-2.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bdffd126d2eb26acf1066acb54cb2e336682e1d72b974a40894fac76a4df17f6
MD5 a122cf2b57885afcab9451dccace8cf9
BLAKE2b-256 7a6c79cd5bc1b880d8c1a9a5550aa8dacd57353fa3bb2457227e1fb47383eb49

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page