Skip to content

Utility to mount Docker images locally without requiring container creation

License

Notifications You must be signed in to change notification settings

JosephRedfern/docker-mounter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-mounter

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!

Installation

This tool can be installed from PyPI using:

pip install docker-mounter

Alternatively, the tool can be installed from source using:

poetry install

Compatibility

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.

Required Permissions

This tool requires:

  1. Access to the Docker daemon socket (user must be root or in the docker group)
  2. Root privileges when using the --mount option

Usage

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.    │
╰─────────────────────────────────────────────────────────────────────╯

Example Usage

Mount ubuntu:latest image to /mnt/docker-image and pull the image if it is not present

sudo docker-mount --mount --pull --mount-point /mnt/docker-image ubuntu:latest

Mount ubuntu:latest image to /mnt/docker-image and do not pull the image

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

About

Utility to mount Docker images locally without requiring container creation

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages