Dockerblade makes it easy to interact with Docker containers by providing an API, inspired by Python’s standard libraries (e.g., subprocess, os, and io) for executing commands and interacting with filesystems.
Installation
To install the latest release of dockerblade via pipenv
or pip:
$ pipenv install dockerblade
Usage
To connect to a Docker daemon on the host machine and attach to a running container:
import dockerblade
daemon = dockerblade.DockerDaemon()
container = daemon.attach('name-of-the-container')
To perform filesystem operations on a container:
filesystem = container.filesystem()
# write text to a file
filesystem.write('/tmp/foo', 'Hello world!')
# remove a file (inspired by os.remove)
filesystem.remove('/tmp/foo')
# see API docs for more operations
...
To execute commands inside the container:
# specify the shell that should be used (e.g., /bin/sh, /bin/bash, /bin/zsh)
shell = container.shell('/bin/bash')
# obtain the value of an environment variable
val = container.environ('LD_LIBRARY_PATH')
# create a Popen
process = shell.popen('sleep 5')
retcode = process.wait()
# execute a command
assert shell.check_output('echo "Hello World"') == 'Hello World'
# see API docs for more operations
...
API Documentation
API documentation is available at: https://www.christimperley.co.uk/dockerblade
Metadata
Release files for dockerblade 0.6.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dockerblade-0.6.3.tar.gz | 20.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dockerblade-0.6.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.2 kB
Release files / dockerblade-0.6.3.tar.gz
| Download URL | dockerblade-0.6.3.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8250e89ba7d24c26c47641ed4481827d46bc18aae8700e8a17fb76410470d91f
|
|
BLAKE2b-256 checksum How to use checksums |
72231ce36ebfe27b491b90be9ca85758153444c2a08f51d71639e2743bb8e40c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.12.2 Darwin/23.4.0
|
Release files / dockerblade-0.6.3-py3-none-any.whl
| Download URL | dockerblade-0.6.3-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
17721034afce3999efbfa0f9e27292eb1b7dc05b1e43e2075e02250c03a803b0
|
|
BLAKE2b-256 checksum How to use checksums |
2254f714558cdcd99800a24867b51701d0a987ce228e05844aed20a7a81c373c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.12.2 Darwin/23.4.0
|
Security for dockerblade 0.6.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.