lxc 容器无法在 14.04 trusty 中使用“lxc.start.auto = 1”自动启动

use*_*046 5 autostart lxc 14.04

尽管所有设置都设置为 14.04 要求,但在可信赖的 14.04 容器中无法自动启动。他们都显示为 STOPPED

我已经正确配置了 2 个 LXC 容器:

calypso  
encelado
Run Code Online (Sandbox Code Playgroud)

如果我跑,它们就会完美运行
sudo lxc-autostart

然后
sudo lxc-ls --fancy 导致:

ubuntu@saturn:/etc/init$ sudo lxc-ls --fancy 
NAME      STATE    IPV4           IPV6  AUTOSTART 

calypso   RUNNING  192.168.1.161  -     YES        
encelado  RUNNING  192.168.1.162  -     YES 
Run Code Online (Sandbox Code Playgroud)

问题是试图在启动时运行它们。

我在/var/lib/lxc/calypso/config::

# Template used to create this container: /usr/share/lxc/templates/lxc-download 
# Parameters passed to the template:
# For additional config options, please look at lxc.conf(5)

# Distribution configuration
lxc.include = /usr/share/lxc/config/ubuntu.common.conf
lxc.arch = x86_64

# Container specific configuration
lxc.rootfs = /var/lib/lxc/calypso/rootfs 
lxc.utsname = calypso

# Network configuration
lxc.network.type = veth
lxc.network.flags = up
#lxc.network.link = lxcbr0
lxc.network.link = br0
lxc.network.hwaddr = 00:16:3e:64:0b:6e  

# Assign static IP Address
lxc.network.ipv4 = 192.168.1.161/24
lxc.network.ipv4.gateway = 192.168.1.1 

# Autostart
lxc.start.auto = 1
lxc.start.delay = 5
lxc.start.order = 100
Run Code Online (Sandbox Code Playgroud)

我有 LXC_AUTO="false" 里面的要求/etc/default/lxc

LXC_AUTO="false"
USE_LXC_BRIDGE="false"  # overridden in lxc-net
[ -f /etc/default/lxc-net ] && . /etc/default/lxc-net
LXC_SHUTDOWN_TIMEOUT=120
Run Code Online (Sandbox Code Playgroud)

关于为什么容器不在启动时启动的任何想法?在重新启动时,它们始终处于 STOPPED 状态:

ubuntu@saturn:~$ sudo lxc-ls --fancy
NAME      STATE    IPV4  IPV6  AUTOSTART 
calypso   STOPPED  -     -     YES       
encelado  STOPPED  -     -     YES   
Run Code Online (Sandbox Code Playgroud)

然后它们可以再次手动启动,使用 sudo lxc-autostart

stg*_*ber 7

你说:

我在 /etc/default/lxc 中有 LXC_AUTO="false"

这特别告诉新贵工作不要启动任何容器。只是不要设置它或将其设置为 true,您会注意到容器在启动时启动。