Harish Vishwanath
2015-Dec-22 09:21 UTC
[libvirt-users] Setting environment variables for LXC Containers
Hello Is there a way to set custom environment variables for LXC containers so that it is available for all processes within the container? The libvirt-lxc driver seems to be setting up only the below variables (as per the docs), but there doesn't seem to be a way customize it. containerThe fixed string libvirt-lxc to identify libvirt as the creator container_uuidThe UUID assigned to the container by libvirtPATHThe fixed string /bin:/usr/binTERMThe fixed string linuxHOMEThe fixed string / In addition to the standard variables, the following libvirt specific environment variables are also provided LIBVIRT_LXC_NAMEThe name assigned to the container by libvirt LIBVIRT_LXC_UUIDThe UUID assigned to the container by libvirt LIBVIRT_LXC_CMDLINEThe unparsed command line arguments specified in the container configuration. Use of this is discouraged, in favour of passing arguments directly to the container init process via the initarg config element. I am looking for something similar to this: https://linuxcontainers.org/lxc/manpages/man5/lxc.container.conf.5.html (lxc.environment) Regards, Harish
Daniel P. Berrange
2015-Dec-22 10:21 UTC
Re: [libvirt-users] Setting environment variables for LXC Containers
On Tue, Dec 22, 2015 at 02:51:45PM +0530, Harish Vishwanath wrote:> Hello > > Is there a way to set custom environment variables for LXC containers so > that it is available for all processes within the container? > > The libvirt-lxc driver seems to be setting up only the below variables (as > per the docs), but there doesn't seem to be a way customize it. > containerThe fixed string libvirt-lxc to identify libvirt as the creator > container_uuidThe UUID assigned to the container by libvirtPATHThe fixed > string /bin:/usr/binTERMThe fixed string linuxHOMEThe fixed string / > > In addition to the standard variables, the following libvirt specific > environment variables are also provided > LIBVIRT_LXC_NAMEThe name assigned to the container by libvirt > LIBVIRT_LXC_UUIDThe UUID assigned to the container by libvirt > LIBVIRT_LXC_CMDLINEThe unparsed command line arguments specified in the > container configuration. Use of this is discouraged, in favour of passing > arguments directly to the container init process via the initarg config > element.I thought we had implemented the ability to set custom env variables, but looking at the code again, it seems we did not get around to it. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|