Closed onlyjob closed 5 years ago
Hi @onlyjob!
Typically I've seen LXC used primarily for "system containers" (sometimes referred to as "machine containers"). From their own website:
Our main focus is system containers. That is, containers which offer an environment as close as possible as the one you'd get from a VM but without the overhead that comes with running a separate kernel and simulating all the hardware.
Usually that includes running something like systemd
or runit
or supervisord
as PID1 in the container to determine what services are going to be run.
That being said, I think you probably want to use the template
field to pass the appropriate set of instructions for the container to execute.
Thank you for explanation. But template
takes exactly one parameter so there seems to be no way to pass any parameters other than volumes and the name of the template...
It looks like LXC is expecting extra args to be passed into the template, and I checked the API of library we're using here and there's a TemplateOptions.ExtraArgs
parameter. But then I dug into the codebase here and it turns out we do allow a template_args
parameter which gets passed to the LXC create call at lxc/lxc.go#L229
!
So this looks like there's some missing documentation on the Nomad website. If you'd like to contribute a patch to the LXC driver docs that'd be awesome. Otherwise I'll try to do that shortly.
Awesome. Thanks, @tgross.
I probably won't be able to contribute anything any time soon. Please do not wait for me...
I've opened https://github.com/hashicorp/nomad/pull/6640 with that documentation update.
Thanks for preparing this merge request. I could not possibly provide that much information as I did not know any of that...
Thank you.
Apparently driver-lxc do not understand "command" keyword in the "config" section.
How can I run an arbitrary command in LXC container?
Is LXC driver not suitable for batch jobs?
Limitations and use cases should be documented.