Skip to main content

Creating a docker image from a live ISO

Download Live ISO, example 

Example: debian ISO: debian-live-13.1.0-amd64-standard.iso

https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/

Make a directory to mount the ISO
sudo mkdir /media/iso
Mount the ISO to the /media/iso
sudo mount -o loop debian-live-13.1.0-amd64-standard.iso /media/iso
Extract the Root Filesystem using SquashFS
sudo unsquashfs -d .debian-fs /mnt/media/iso/live/filesystem.squashfs
Delete unnecessary files
sudo rm -rf "./debian-fs/proc" "./debian-fs/sys" "./debian-fs/dev" "./debian-fs/run"
Create a compressed file of the root filesystem
sudo tar -C ./debian-fs -czf debian-fs.tar.gz
Import the compressed Debian filesystem into Docker as an Image
cat debian-fs.tar.gz | docker import - debian-image:latest
Run the Docker Container
docker run -it debian-image /bin/bash