Utility to mount Docker images locally without requiring container creation. This is useful for analysing contents of Docker images from within the host operating system without incurring the overhead of container creation.
This tool relies on some potentially unstable docker implementation details, and may break in future Docker versions!
This tool can be installed from PyPI using:
pip install docker-mounter
Alternatively, the tool can be installed from source using:
poetry install
Due to use of overlay2, tool is only compatible with Linux 3.19+.
It has currently only been tested with Docker version 27.3.1, build ce12230.
This tool requires:
- Access to the Docker daemon socket (user must be root or in the docker group)
- Root privileges when using the
--mount
option
Usage: docker-mount [OPTIONS] IMAGE
╭─ Arguments ─────────────────────────────────────────────────────────╮
│ * image TEXT [default: None] [required] │
╰─────────────────────────────────────────────────────────────────────╯
╭─ Options ───────────────────────────────────────────────────────────╮
│ --mount-point PATH [default: None] │
│ --pull --no-pull [default: no-pull] │
│ --mount --no-mount [default: no-mount] │
│ --help Show this message and exit. │
╰─────────────────────────────────────────────────────────────────────╯
sudo docker-mount --mount --pull --mount-point /mnt/docker-image ubuntu:latest
sudo docker-mount --mount --no-pull --mount-point /mnt/docker-image ubuntu:latest
Generate command to mount ubuntu:latest image to /mnt/docker-image but do not mount or pull the image
docker-mount --mount-point /mnt/docker-image ubuntu:latest