https://github.com/rycus86/docker_helper
Convenience utilities for Python applications in Docker containers
https://github.com/rycus86/docker_helper
Last synced: about 1 year ago
JSON representation
Convenience utilities for Python applications in Docker containers
- Host: GitHub
- URL: https://github.com/rycus86/docker_helper
- Owner: rycus86
- License: mit
- Created: 2017-12-06T18:27:17.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-29T12:44:55.000Z (about 8 years ago)
- Last Synced: 2025-02-23T19:38:59.706Z (over 1 year ago)
- Language: Python
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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