Skip to main content

build status pre-commit.ci status

dockerfile

The goal of this repository is to provide a wrapper around docker/docker's parser for dockerfiles.

python library

Installation

This project uses setuptools-golang when built from source. To build from source you'll need a go compiler.

If you're using linux and sufficiently new pip (>=8.1) you should be able to just download prebuilt manylinux1 wheels.

pip install dockerfile

Usage

There's three api functions provided by this library:

dockerfile.all_cmds()

List all of the known dockerfile cmds.

>>> dockerfile.all_cmds()
('add', 'arg', 'cmd', 'copy', 'entrypoint', 'env', 'expose', 'from', 'healthcheck', 'label', 'maintainer', 'onbuild', 'run', 'shell', 'stopsignal', 'user', 'volume', 'workdir')

dockerfile.parse_file(filename)

Parse a Dockerfile by filename. Returns a tuple of dockerfile.Command objects representing each layer of the Dockerfile. Possible exceptions:

  • dockerfile.GoIOError: The file could not be opened.
  • dockerfile.GoParseError: The Dockerfile was not parseable.
>>> pprint.pprint(dockerfile.parse_file('testfiles/Dockerfile.ok'))
(Command(cmd='from', sub_cmd=None, json=False, original='FROM ubuntu:xenial', start_line=1, flags=(), value=('ubuntu:xenial',)),
 Command(cmd='cmd', sub_cmd=None, json=True, original='CMD ["echo", "hi"]', start_line=2, flags=(), value=('echo', 'hi')))

dockerfile.parse_string(s)

Parse a dockerfile using a string. Returns a tuple of dockerfile.Command objects representing each layer of the Dockerfile. Possible exceptions:

  • dockerfile.GoParseError: The Dockerfile was not parseable.
>>> dockerfile.parse_string('FROM ubuntu:xenial')
(Command(cmd='from', sub_cmd=None, json=False, original='FROM ubuntu:xenial', start_line=1, flags=(), value=('ubuntu:xenial',)),)

go library

Slightly more convenient than the api provided by docker/docker? Might not be terribly useful -- the main point of this repository was a python wrapper.

Installation

go get github.com/asottile/dockerfile

Usage

godoc

Metadata

Release files for dockerfile 3.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dockerfile 3.4.0
File Size Uploaded
dockerfile-3.4.0.tar.gz 7.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for dockerfile 3.4.0
File
dockerfile-3.4.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
dockerfile-3.4.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl CPython 3.9 abi3 Linux glibc 2.5+ x86-64 Details
dockerfile-3.4.0-cp39-abi3-macosx_14_0_arm64.whl CPython 3.9 abi3 macOS 14.0+ ARM64 Details
dockerfile-3.4.0-cp39-abi3-macosx_13_0_x86_64.whl CPython 3.9 abi3 macOS 13.0+ x86-64 Details

Total release size: 6.9 MB

Release files / dockerfile-3.4.0.tar.gz

Download URL dockerfile-3.4.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
238bb950985c55a525daef8bbfe994a0230aa0978c419f4caa4d9ce0a37343f1
BLAKE2b-256 checksum
How to use checksums
dec92cdd6060f8f476c41a1638a9e1b28923fb0d9c075dffc41b13137199e207
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / dockerfile-3.4.0-cp39-abi3-win_amd64.whl

Download URL dockerfile-3.4.0-cp39-abi3-win_amd64.whl
Size 1.8 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
30202187f1885f99ac839fd41ca8150b2fd0a66fac12db0166361d0c4622e71a
BLAKE2b-256 checksum
How to use checksums
815d3d3b83501e62f6f319db884113bab89fc02b6c29ca7004049a8144eec01e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / dockerfile-3.4.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl

Download URL dockerfile-3.4.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Size 1.7 MB
Tags CPython 3.9 Linux glibc 2.5+ x86-64 abi3
SHA-256 checksum
How to use checksums
b95102bd82e6f67c836186b51c13114aa586a20e8cb6441bde24d4070542009d
BLAKE2b-256 checksum
How to use checksums
0b352cb27f4a0a68bacde1bdbc2cd4ba8d0d5be95fca04010c7bd83caa96cd20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / dockerfile-3.4.0-cp39-abi3-macosx_14_0_arm64.whl

Download URL dockerfile-3.4.0-cp39-abi3-macosx_14_0_arm64.whl
Size 1.6 MB
Tags CPython 3.9 abi3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
a4549d4f038483c25906d4fec56bb6ffe82ae26e0f80a15f2c0fedbb50712053
BLAKE2b-256 checksum
How to use checksums
8ebf246a02d803318131d809b13d285244e4047def667df906ad123e7d8405b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / dockerfile-3.4.0-cp39-abi3-macosx_13_0_x86_64.whl

Download URL dockerfile-3.4.0-cp39-abi3-macosx_13_0_x86_64.whl
Size 1.7 MB
Tags CPython 3.9 abi3 macOS 13.0+ x86-64
SHA-256 checksum
How to use checksums
ed33446a76007cbb3f28c247f189cc06db34667d4f59a398a5c44912d7c13f36
BLAKE2b-256 checksum
How to use checksums
a12a553b099124685f00c4cc06cda6496db02e43ca51d7b7b5dc68814c6b48be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

3.4.0 This release

5 release files

3.3.1

5 release files

3.3.0

5 release files

3.2.0

4 release files

3.1.0

3 release files

3.0.0

3 release files

2.2.0

9 release files

2.1.0

9 release files

2.0.2

5 release files

2.0.1

6 release files

2.0.0

7 release files

1.0.1

7 release files

1.0.0

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page