Skip to content

Latest commit

 

History

History
46 lines (31 loc) · 1.13 KB

README.md

File metadata and controls

46 lines (31 loc) · 1.13 KB

Chroot from image

This repository contains a simple Bash script to chroot in any Linux distribution. Its filesystem is extracted from a docker image and then mounted. You can learn more in my dedicated blog post.

Usage

./chroot-from-image <image> <command>

Example

./chroot_from_image centos
./chroot_from_image ubuntu:20.04
./chroot_from_image alpine /bin/sh
./chroot_from_image exherbo/exherbo-x86_64-pc-linux-gnu-gcc-base

This also works with Podman and alternative hubs, if configured to be used from the docker command.

Unmounting and cleaning

Mounted directories and exported container are automatically cleaned up when you exit the chroot environment. If you need to clean up manually, there is the clean_image script.

Usage

./clean_image <image>

Example

./clean_image centos
./clean_image ubuntu:20.04
./clean_image alpine
./clean_image exherbo/exherbo-x86_64-pc-linux-gnu-gcc-base

License

This project is under the MIT License.


[]: # Path: LICENSE