Skip to main content

Convenience utilities for Python applications in Docker containers

Project description

# Docker Helper

Convenience utilities for Python applications in Docker containers.

## Functions

- Get current container ID

```python
get_current_container_id()
```

Returns the ID of the container the application is currently running in,
otherwise returns `None` if not running in a container.

> This is done on a best-effort basis, guessed from the information in `/proc/self/cgroup`

- Read configuration values

```python
read_configuration(key, path=None, default=None,
single_config=False, fallback_to_env=True)
```

A convenient way to read configuration values from files with an option
to fall back to using environment variables.
This can come handy to pass in multiple configuration options as key-value pairs
using Docker configs or secrets when working with Swarm services.
When `single_config` is `True`, the configuration file is treated as a single text value
which is useful to read JSON configuration for example for an application.

## License

MIT

Project details


Download files

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

Files for docker-helper, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size docker_helper-0.0.2.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page