[lxc-users] Adding a host block device to a container

Peter Steele pwsteele at gmail.com
Tue Sep 1 16:22:30 UTC 2015


On 09/01/2015 09:15 AM, Serge Hallyn wrote:
> In that case that's exactly what templates were meant to do.  So while
> I'd still like to see lxc-device updated to support persistence, you
> could do what you want by
>
> 1. creating a lxc.hook.autodev hook which creates the device you want
>     using mknod,
> 2. adding lxc.hook.autodev = /usr/local/bin/my-dev-hook to the container
>     configuration
> 3. adding the lxc.cgroup rule you need to the container configuration
>
> You could add the two config additions to your global
> /etc/lxc/default.conf, add them to the config you pass to
> lxc-create -f, or set them in a new template you create and use
> instead of /bin/true.
>
Using /bin/true was the quickest way to get off to the races, using a 
template I had already been using for libvirt-lxc. It definitely makes 
sense though to take it to the next step and turn my template into a 
proper lxc template. I'll get there eventually.



More information about the lxc-users mailing list