How to run a script in a container?

janvv

Active Member
Jun 21, 2020
63
11
28
66
52.24154182722349, 5.117853866801705
How can I run a shell script in a container after creation?
I can copy a script file into the container by using 'pct push <vmid> etc..'
But then...
How can I run it without login in?

I want to create a container fully automated and run some scripts in it to do intial configuration. This is the last step that I am missng.
 
From what I understand <command> can have no options or arguments to it. Gets very complex if you want some.
 
From what I understand <command> can have no options or arguments to it. Gets very complex if you want some.
Use pct exec <ct id> -- <command> <option1> <arg1> <option2> <arg2> ,,,
For example pct exec 100 echo -n arg1 arg2 will give an error (because of the -n and works fine without it) but pct exec 100 -- echo -n arg1 arg2 works as expected.
 
  • Like
Reactions: mathx and LnxBil