How to create and use templates
Templates can save you precious time!
Set up a jail any way you like, and create a template from it. All packages and pre-configured settings will be available for deployment next time within seconds.
Any jail can be converted to a template and back to a jail again as required. In fact a template is just another jail which has the property template set to “yes”. The difference is that templates are not started by iocage, they ar$
Here is how to create a template with iocage:
- Create a new jail iocage create tag=mytemplate
- Configure the jail’s networking
- Install any package you like and customize jail
- Once finished with customization stop the jail iocage stop UUID | TAG
- A good idea is set some notes iocage set notes="customized PHP,nginx jail" UUID | TAG
- Turn the template property on iocage set template=yes UUID | TAG
- List your template with iocage list -t
Here is how to use the created template:
To create a new jail from this template simply clone it!
- iocage clone UUID-of-mytemplate tag=mynewjail
- List new jail iocage list
- Start jail iocage start UUID | TAG
Done!
If you need to make further customization in the template or want to patch it, you have two options.
- convert template back to jail with iocage set template=no UUID-of-template, and start the jail
- if you don’t need network access to make the changes simply run iocage chroot UUID-of-template, make the changes and exit