lxc 命令 lxc start 和 lxc-start 等有什么区别?

Lea*_*Man 5 lxc lxd

从文档中不清楚 lxc start 和 lxc-start 之间有什么区别,并且 --help 提供了不同的用法和开关。教程使用这两种变体,但更深入地研究文档,似乎 lxc-start 适合在容器内运行的应用程序,而 lxc start 用于启动容器。无论哪种方式都不清楚,因为它没有解释这些命令是彼此的链接还是完全不同。我犯了这样的错误:“它们在不同的二进制文件、不同的代码路径中是不同的,但最终通过一些修改在引擎盖下聚合”。

文档:http://manpages.ubuntu.com/manpages/bionic/man1/lxc-start.1.html

$ lxc-start --help
Usage: lxc-start --name=NAME -- COMMAND

lxc-start start COMMAND in specified container NAME

Options :
  -n, --name=NAME        NAME of the container
  -d, --daemon           Daemonize the container (default)
  -F, --foreground       Start with the current tty attached to /dev/console
  -p, --pidfile=FILE     Create a file with the process id
  -f, --rcfile=FILE      Load configuration file FILE
  -c, --console=FILE     Use specified FILE for the container console
  -L, --console-log=FILE Log container console output to FILE
  -C, --close-all-fds    If any fds are inherited, close them
                         If not specified, exit with failure instead
                         Note: --daemon implies --close-all-fds
  -s, --define KEY=VAL   Assign VAL to configuration variable KEY
      --share-[net|ipc|uts]=NAME Share a namespace with another container or pid

Common options :
  -o, --logfile=FILE               Output log to FILE instead of stderr
  -l, --logpriority=LEVEL          Set log priority to LEVEL
  -q, --quiet                      Don't produce any output
  -P, --lxcpath=PATH               Use specified container path
  -?, --help                       Give this help list
      --usage                      Give a short usage message
      --version                    Print the version number

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

See the lxc-start man page for further information.

Run Code Online (Sandbox Code Playgroud)

文档:http://manpages.ubuntu.com/manpages/bionic/man7/lxc.7.html

$ lxc start --help
Usage: lxc start [<remote>:]<container> [[<remote>:]<container>...]

Start containers.

Options:
    --debug  (= false)
        Enable debug mode
    --force-local  (= false)
        Force using the local unix socket
    --no-alias  (= false)
        Ignore aliases when determining what command to run
    --stateful  (= false)
        Store the container state (only for stop)
    --stateless  (= false)
        Ignore the container state (only for start)
    --verbose  (= false)
        Enable verbose mode
Run Code Online (Sandbox Code Playgroud)

Lea*_*Man 1

来自https://discuss.linuxcontainers.org/t/comparing-lxd-vs-lxc/24

\n

它指出,

\n
\n

长xd

\n

lxd 是 LXD 守护进程。为了与守护进程交互(例如创建和管理容器),您需要使用 lxc 命令。您通常不想\xe2\x80\x99直接调用lxd \xe2\x80\x93,除非您需要运行lxd init或其他东西;检查 man lxd 或 lxd --help 以获取有关直接运行 lxd 可以做什么的更多信息,但是一旦从 init 系统运行它,您可能不需要再次直接调用它,除非您是调试 LXD 本身。

\n

lxc命令是LXD前端(\xe2\x80\x9cLXD Client\xe2\x80\x9d 是我的想法)。

\n

但是,如果您\xe2\x80\x99尝试使用LXD,则应避免使用任何以lxc-开头的命令(即\xe2\x80\x99s lxc,后跟一个短连字符)!这些命令与 LXC 相关。

\n

长沙

\n

LXC 命令开头为lxc-(\xe2\x80\x99s lxc 后跟一个短连字符)开头。如果\xe2\x80\x99s没有连字符,只是字面命令lxc,即\xe2\x80\x99s与LXD关联。

\n
\n