container-inspector
raw JSON → 33.1.0 verified Fri May 01 auth: no python
Docker, containers, rootfs and virtual machine related software composition analysis (SCA) utilities. Current version 33.1.0, requires Python >=3.10. Released by AboutCode.org.
pip install container-inspector Common errors
error ModuleNotFoundError: No module named 'container_inspector' ↓
cause Pip installed the package as container-inspector but import uses underscores.
fix
pip install container-inspector && import container_inspector
error AttributeError: 'Image' object has no attribute 'parent_id' ↓
cause parent_id was removed in version 21.5.25.
fix
Use archive_location or extracted_location instead.
error TypeError: extract_tar() got an unexpected keyword argument 'skip_symlinks' ↓
cause skip_symlinks parameter added in v31.0.0; older version does not support it.
fix
Upgrade to >=31.0.0 or remove skip_symlinks argument.
error FileNotFoundError: [Errno 2] No such file or directory: 'manifest.json' ↓
cause The provided archive is not a valid Docker image tarball (missing manifest.json).
fix
Use a proper Docker image archive: docker save -o image.tar <image>
Warnings
breaking Python 3.6 support dropped in v32.0.0. ↓
fix Upgrade to Python 3.7+.
breaking extract_tar now returns a list of ExtractEvent (or error strings) instead of just strings. Use as_events=False for old behavior. ↓
fix Set as_events=False to get list of error strings, or handle ExtractEvent objects.
deprecated parent_id and parent_digest attributes removed from Image. ↓
fix Use archive_location and extracted_location instead.
gotcha The library name is container-inspector but import module uses underscores: container_inspector. ↓
fix Always import with underscores: import container_inspector
gotcha Docker archives must be in tarball format (e.g., docker save output). ↓
fix Ensure the archive is a tar file containing manifest.json and layer tarballs.
Imports
- Image
from container_inspector.image import Image - Layer
from container_inspector.layer import Layer - rootfs_from_dir
from container_inspector.rootfs import rootfs_from_dir - image_from_archive wrong
from container_inspector import image_from_archivecorrectInternal server error