containerutil
containerutil.Path
provides API similar to pathlib.Path for inspecting
docker container file system:
import docker
import containerutil
client = docker.from_env(version='auto')
ctnr = client.containers.get('my-container')
p = containerutil.Path(ctnr, '/foo/bar/path')
p.exists() # True if file exists (regardless of type)
p.is_file() # True if file exists and is a regular file
p.is_symlink() # True if file exists and is a symbolic link
p.is_fifo() # True if file is a named pipe (FIFO)
Installation
From PyPI using pip
package manager:
pip install --upgrade containerutil
Or install the latest sources from GitHub:
pip install https://github.com/pavdmyt/containerutil/archive/master.zip
Development
Clone the repository:
git clone https://github.com/pavdmyt/containerutil.git
Install dependencies:
make install
Lint code:
make lint
Run tests:
make test
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
- Make sure tests are passing
License
MIT - Pavlo Dmytrenko