How to? Single execution containers

garyd9

Member
Nov 10, 2023
44
3
8
If there's a documentation page for this, I apologize for missing it (please point me there.)

Currently, the containers I have are based on the proxmox templates for debian standard, meaning they are full debian systems. If I want a container that runs a webpage, I create a "debian standard" template, run "apt install nginix", ensure systemd starts up nginx, etc.

Is there a way to set up a proxmox-based linux container to run a single program and have the container terminate when the program terminates? I don't want or need a full linux distribution to start up. Using my above nginx example, I just want enough to run nginx (and whatever dependencies my web pages might have) and the container should be centered around that.

Thank you
 
Wouldn't it then be better to use application containers like docker instead of system containers like LXCs?
I suppose you might say I'm trying to use an lxc container in a similar fashion as a docker container. Without the overhead of having docker installed in a container (or VM.)
 
I've setup a VM template to run a single application (mostly firefox) inside a whole desktop environment (SPICE) and start VM's based on that with a script, using the Proxmox command-line interface and QEMU guest agent. I guess something similar could be done with containers, and I also wonder what people have been concocting. If you want to run every application in a secure partition, you'll might be interested in Qubes OS. Unfortunately, it's based on Xen instead of KVM and Proxmox VE also has a different user group (enterprise hypervisor instead of desktop VMs).
 
I suppose you might say I'm trying to use an lxc container in a similar fashion as a docker container. Without the overhead of having docker installed in a container (or VM.)
There are people that install docker on the PVE host so they can run them without the overhead of a LXC/VM.
 
Just to stay focused, I'm trying to find a way to do this with linux containers. Not with docker.
 
Just to stay focused, I'm trying to find a way to do this with linux containers. Not with docker.
It's the wrong tool for the job as others pointed out, so go ahead and do it your way!
You may want to overwrite the start of the init system in order to run just one command or inject some magic into /etc/rc.local to run your program and exit thereafter.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!