My goal is to enable the persistent data storage using a bigger raspbian buster image file. This is what I did :
1) qemu-img resize 2019-09-26-raspbian-buster-lite.img 32G
2) zip 2019-09-26-raspbian-buster-lite.zip 2019-09-26-raspbian-buster-lite.img
at this point,I realized that for some unknown reason,the zipped file wasn't decompressed correctly by the zip utility,which gives a generic unzip extraction error. So,I've thought to use tar and the error is gone. So we can jump to step 3 :
3) tar -czvf 2019-09-26-raspbian-buster-lite.tar.gz 2019-09-26-raspbian-buster-lite.img
So,now I had to modify slightly Dockerfile and entrypoint.sh files like this :
4) entrypoint.sh :
#!/bin/sh
GIB_IN_BYTES="1073741824"
target="${1:-pi1}"
image_path="/sdcard/filesystem.img"
zip_path="/filesystem.tar.gz"
if [ ! -e $image_path ]; then
# echo "No filesystem detected at ${image_path}!"
if [ -e $zip_path ]; then
echo "Extracting fresh filesystem..."
# unzip $zip_path
tar -xzvf $zip_path
mv *.img $image_path
else
exit 1
fi
fi
5) Dockerfile :
FROM dockerpi-vm as dockerpi
ARG FILESYSTEM_IMAGE_URL="http://ziomario.ns0.it/2019-09-26-raspbian-buster-lite.tar.gz"
ADD $FILESYSTEM_IMAGE_URL /filesystem.tar.gz
But as I said at the beginning,I wanted to have persistent data storage,but only for the VM model 3,the one with the parameter "machine=raspi3b". I realized that starting the container like this :
-v $HOME/.dockerpi:/sdcard lukechilds/dockerpi
it enables the persistence of the datas only for the VM model 1,the one with the paramter "machine=versatilepb" but I'm not interested to it AND if I start the VM like this :
My goal is to enable the persistent data storage using a bigger raspbian buster image file. This is what I did :
1) qemu-img resize 2019-09-26-raspbian-buster-lite.img 32G 2) zip 2019-09-26-raspbian-buster-lite.zip 2019-09-26-raspbian-buster-lite.img
at this point,I realized that for some unknown reason,the zipped file wasn't decompressed correctly by the zip utility,which gives a generic unzip extraction error. So,I've thought to use tar and the error is gone. So we can jump to step 3 :
3) tar -czvf 2019-09-26-raspbian-buster-lite.tar.gz 2019-09-26-raspbian-buster-lite.img
So,now I had to modify slightly Dockerfile and entrypoint.sh files like this :
4) entrypoint.sh :
5) Dockerfile :
But as I said at the beginning,I wanted to have persistent data storage,but only for the VM model 3,the one with the parameter "machine=raspi3b". I realized that starting the container like this :
-v $HOME/.dockerpi:/sdcard lukechilds/dockerpi
it enables the persistence of the datas only for the VM model 1,the one with the paramter "machine=versatilepb" but I'm not interested to it AND if I start the VM like this :
-v $HOME/.dockerpi:/sdcard lukechilds/dockerpi pi3
it is not supported. It doesn't even enable the persistence for the VM model 3,but only for the model 1. So,let's jump to point 6)
6) I have modified again the entrypoint.sh script like this :
and finally,point 7 :
7) I can start the container with this start.sh script :
8) and now,after having did all of this,I get the following error when it decompress the tar.gz image file :