[SOLVED] LXC prehooks question

jmeech

New Member
Feb 1, 2023
5
0
1
is it possible to pass a script that is running configured to run in the lxc-prehooks line the container id or config file its running from?

ie if i have a /etc/pve/lxc/100.conf does proxmox create any environment variables or whatever i could access so my script knows what lxc container is calling it?

I think that makes sense... hopefully
 
Hi, I think the LXC hook script can read the VMID from the LXC_NAME environment variable.
 
I am new to LXC and PVE.

I am trying to pass environment variables to an LXC container, I can do this with Docker.

Is there a way to do that?

It seems you are trying/doing something similar.
not exactly im trying to access the variable by a script thats launched on the host before running the vm,

afaik there is no way to pass variables into the lxc as you would docker, however you could do something like create a bind mount that creates an ENV file inside your container somewhere and use an lxc prehook script to update the contents of that ENV file i suppose
 

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!