https://github.com/negrel/ocimount
Mount OCI/Docker images.
https://github.com/negrel/ocimount
docker go golang mount oci
Last synced: 4 months ago
JSON representation
Mount OCI/Docker images.
- Host: GitHub
- URL: https://github.com/negrel/ocimount
- Owner: negrel
- License: mit
- Created: 2022-10-14T22:50:43.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-10-31T21:54:19.000Z (over 2 years ago)
- Last Synced: 2025-01-08T09:13:58.398Z (5 months ago)
- Topics: docker, go, golang, mount, oci
- Language: Go
- Homepage:
- Size: 122 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OCIMount - Mount OCI/Docker images.
OCIMount is a tool to mount OCI/Docker image easily.
## Getting started
Let's start by installing `ocimount`.
### Installation
```shell
go install github.com/negrel/ocimount@latest
```### Usage
```shell
# Print help informations
ocimount --help
```Mount an image as read-only:
```shell
anegrel$ ocimount mount archlinux:latest
INFO[0000] failed to get store, trying again in unshare mode.
ERRO[0000] failed to mount "archlinux:latest": chown /var/home/anegrel/.local/share/containers/storage/overlay/l: operation not permitted# Oops, it seems that we can't access the storage.
# Let's enter image modified user namespace:
anegrel$ ocimount unshareroot# ocimount mount archlinux:latest
INFO[0000] "docker.io/library/archlinux:latest" successfully mounted at "/var/home/anegrel/.local/share/containers/storage/overlay/de3fc361158be7fbfc230f523b9df392bcf95cba5cf88141292374bf1ec7d2a7/merged".
/var/home/anegrel/.local/share/containers/storage/overlay/de3fc361158be7fbfc230f523b9df392bcf95cba5cf88141292374bf1ec7d2a7/merged# That's it, out image is mounted read-only.
# Mountpoint is always print to stdout.
```You can then unmount the image using `umount` command.
> **NOTE**: Checks the `--overlay` and `--bind` flags to mount an image as writable and to a custom mountpoint.
### Testing
This code is widely untested, nevertheless it *should* be harmless as we're only reading from the container store
and performing some `mount` syscall.## Contributing
If you want to contribute to `ocimount` to add a feature or improve the code contact
me at [[email protected]](mailto:[email protected]), open an
[issue](https://github.com/negrel/ocimount/issues) or make a
[pull request](https://github.com/negrel/ocimount/pulls).## :stars: Show your support
Please give a :star: if this project helped you!
[](https://www.buymeacoffee.com/negrel)
## :scroll: License
MIT © [Alexandre Negrel](https://www.negrel.dev/)