Just a quick write up here on how to make a portable image you can mount in LXC which you can move around.
Download minimal ubuntu
Let’s start by downloading a minimal ubuntu raring for this we need sudo:
This will install ubuntu raring into the directory
We can now
chroot into this directory in order to minimize a little and clean the apt-get packages
that got installed during the
You can now install your own software, packages and such. When you are done and ready to package your stuff up you can do:
To clean and exit your
Create a file volume
Next up is creating the file volume which we will mount. And copy the filesystem too so we can move it around as a single file.
Let’s check the size of our
raring directory first.
Remember that amount and lets create an empty file zero padded. The
if means file in, the
of means file out. The
bs the size
of block. The
count means the number of blocks. Replace the count in the sample below with your own count of megabytes, and allocate
a bit extra since
mkfs will steal space some in regards to administraton of blocks.
It will take a while to populate. When done time to
mkfs the image.
After this we can mount the image.
And now we can finally copy our raring directory to our
You can now mount this image in LXC with or without AUFS.
If you want to move it around you can use
tar to compress your image.
Hey you 👋. Want to stay up to date?
Would you like to stay up to date on upcoming learn-togethers or events? Subscribe here! I'll only use your email to keep u up to date on new learnings and coding tips. It wont be shared! Feel free to unsubscribe anytime!