There are some ways to use/copy/convert an existing system for your container/vm:
1. Convert a system into an LXD container with “lxd-p2c”: a tool from the LXD team which essentially just copies the whole system into an LXD container, see:
- How to compile lxd-p2c to migrate physical servers to LXD containers – Mi blog lah!
- HOWTO use lxd-p2c
2. Use a custom ISO for VMs(Virtual machines): see Install any OS via ISO in a Virtual machine/VM
- You can also install an ISO as VM and then convert it to a container with lxd-p2c (but most certainly there are easier and more reliable alternatives to use)
Related, alternative options:
- Use cloud-init to automate the setup of a container/VM: see Advanced Guide - cloud-init