lxc-execute(1)

πŸ’… lxc-execute β€” like, the manual page, but make it make sense

okay so bestie, welcome to lxc-execute(1) β€” the section 1 manual page for lxc-execute, and honestly? it's a slay. it's the "just run my app in a box real quick" command, and i'm gonna walk you through every single flag bc we don't do half-info in this house πŸ’–


✨ NAME ✨

lxc-execute β€” run an application inside a container. that's it. that's the whole vibe. 🫢


🌸 SYNOPSIS 🌸

lxc-execute {-n name} [-d] [-f config_file] [-s KEY=VAL] [-u, --uid uid]
            [-g, --gid gid] [-- command]

like, -n name is basically mandatory (the braces are doing the "you need this" thing), the rest is optional, and the -- command bit at the end is where your actual program lives. periodt. ⭐


πŸ¦‹ DESCRIPTION πŸ¦‹

lxc-execute runs the command you specify inside the container you specify by name. iconic behavior, no notes.

it sets up the container according to the config you already defined earlier with the lxc-create command, or according to the config file parameter. and if there's, like, no configuration defined at all? don't stress β€” the default isolation gets used. πŸ’œ

this command is mainly for when you wanna quickly launch an application in an isolated environment. that's its whole main character energy. it's not trying to be a whole lifestyle, it's trying to spawn your thing in a bubble.

here's the part you actually need to know: lxc-execute will run your specified command into the container via an intermediate process called lxc-init. and lxc-init? after launching the specified command, it waits for its end and all other reparented processes β€” which is how daemons in the container get supported btw, iykyk. in other words: inside the container, lxc-init has pid 1, and the first process of the application has pid 2. yes, the app is literally second in line. πŸ™ˆ

also the above lxc-init is designed to forward received signals to the started command. so signals don't just vanish into the void, they get hand-delivered. πŸ’Œ


πŸŽ€ OPTIONS πŸŽ€

  • -f, --rcfile config_file β€” specify the configuration file that configures the virtualization and isolation functionalities for the container. and heads up: this configuration file, if present, will be used even if there's already a configuration file present in the previously created container (the one made via lxc-create). so it overrides the old one. it said what it said. πŸ’…
  • -s, --define KEY=VAL β€” assign value VAL to configuration variable KEY. this overrides any assignment done in config_file. so it's the boss of the boss. πŸ‘‘
  • -d, --daemon β€” run the container as a daemon. but bestie, listen: as the container has no more tty, if an error occurs nothing will be displayed. nothing. silence. 😭 the log file can be used to check the error, so like, actually use it.
  • -u, --uid uid β€” executes the command with user ID (use numerical value) uid inside the container.
  • --g, --gid gid β€” executes the command with group ID (use numerical value) gid inside the container. (and yes, the page literally writes it as --g, i'm not fixing it, i don't make the rules 🫢)
  • -- β€” signal the end of options and disables further option processing. any arguments after the -- are treated as arguments to command. this one's a lifesaver when you want to specify options to command and you don't want lxc-execute to interpret them. very "not me, that's their business" of you. ✨

🌈 COMMON OPTIONS 🌈

these options are common to most of lxc commands, so you'll see them everywhere like that one friend who's at every party. πŸ“

  • -?, -h, --help β€” print a longer usage message than normal.
  • --usage β€” give the usage message.
  • -q, --quiet β€” mute on. 🀫
  • -P, --lxcpath=PATH β€” use an alternate container path. the default is /var/lib/lxc.
  • -o, --logfile=FILE β€” output to an alternate log FILE. the default is no log.
  • -l, --logpriority=LEVEL β€” set log priority to LEVEL. the default log priority is ERROR. possible values are: FATAL, ALERT, CRIT, WARN, ERROR, NOTICE, INFO, DEBUG, TRACE.
tiny but important caveat: this option is setting the priority of the events log in the alternate log file. it do not have effect on the ERROR events log on stderr. (yes, "it do not" β€” we're keeping it, it's part of the lore now πŸ’€)
  • -n, --name=NAME β€” use container identifier NAME. the container identifier format is an alphanumeric string.
  • --rcfile=FILE β€” specify the configuration file to configure the virtualization and isolation functionalities for the container.

this configuration file, if present, will be used even if there is already a configuration file present in the previously created container (via lxc-create). same deal as the -f one, just spelled differently. twins. πŸ‘―

  • --version β€” show the version number.

πŸ’€ DIAGNOSTIC πŸ’€

  • The container is busy β€” the specified container is already running an application. you should stop it before reuse this container or create a new one. like, it's occupied, it's got a situation going on, don't barge in. πŸšͺ

πŸ”₯ SEE ALSO πŸ”₯

lxc(7), lxc-create(1), lxc-copy(1), lxc-destroy(1), lxc-start(1), lxc-stop(1), lxc-execute(1), lxc-console(1), lxc-monitor(1), lxc-wait(1), lxc-cgroup(1), lxc-ls(1), lxc-info(1), lxc-freeze(1), lxc-unfreeze(1), lxc-attach(1), lxc.conf(5)

(yes lxc-execute(1) links to itself in there. self-love, we stan. πŸ’–)


and that's the whole page, bestie!! 🧚 this lil masterpiece comes from the lxc source (version/date stamped 2026-05-01) β€” so go forth, execute things in containers, and remember: pid 1 is lxc-init's job, not yours. mwah πŸ’‹πŸŒΈ

πŸ“¦ where this page comes from