外部驱动器上的 LxD 容器无法在另一台主机上启动

外部驱动器上的 LxD 容器无法在另一台主机上启动

我在 2 台主机上运行相同的操作系统 (Ubuntu 16.04),并具有相同的操作系统更新。

我还在两台主机上安装(通过sudo apt-get install lxd)并配置(通过)相同的 LxD 服务。sudo lxd init

现在,出于节省空间、便携性/工作连续性的原因(因为这两个主机位于不同的物理位置,位于我无法控制的防火墙后面),我想,为什么不把所有 LxD 图像和容器安装在一个外部驱动器上,这样我就可以交替地插入一个主机或另一个主机。

为此,我在主机 A 上安装了我想要的图像并设置了所需的容器,并将、和文件夹(及其内容)复制/var/lib/lxd/var/log/lxd外部/var/cache/lxd驱动器。

当我将外部驱动器插入主机 B 时,我实际上可以从主机 A 正常看到我的映像和(已停止的)容器列表。我甚至可以在主机 B 上从原始主机 A 映像启动新容器。

但是,当在主机 BI 上尝试启动一个容器时(该容器foo最初在主机 A 上启动并停止),我收到以下错误:

$ lxc start foo
error: Error calling 'lxd forkstart foo /var/lib/lxd/containers /var/log/lxd/foo/lxc.conf': err='exit status 1'
  lxc 20161217084040.956 ERROR lxc_start - start.c:lxc_spawn:1162 - failed to set up id mapping
  lxc 20161217084041.013 ERROR lxc_start - start.c:__lxc_start:1354 - failed to spawn 'foo'
  lxc 20161217084041.564 ERROR lxc_conf - conf.c:run_buffer:347 - Script exited with status 1
  lxc 20161217084041.564 ERROR lxc_start - start.c:lxc_fini:555 - failed to run post-stop hooks for container 'foo'.
  lxc 20161217084041.566 ERROR lxc_conf - conf.c:userns_exec_1:4334 - Error setting up child mappings
  lxc 20161217084041.566 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:983 - Error destroying /sys/fs/cgroup/systemd//lxc/foo
  lxc 20161217084041.568 ERROR lxc_conf - conf.c:userns_exec_1:4334 - Error setting up child mappings
  lxc 20161217084041.568 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:983 - Error destroying /sys/fs/cgroup/pids//lxc/foo
  lxc 20161217084041.569 ERROR lxc_conf - conf.c:userns_exec_1:4334 - Error setting up child mappings
  lxc 20161217084041.569 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:983 - Error destroying /sys/fs/cgroup/net_cls//lxc/foo
  lxc 20161217084041.571 ERROR lxc_conf - conf.c:userns_exec_1:4334 - Error setting up child mappings
  lxc 20161217084041.571 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:983 - Error destroying /sys/fs/cgroup/hugetlb//lxc/foo
  lxc 20161217084041.573 ERROR lxc_conf - conf.c:userns_exec_1:4334 - Error setting up child mappings
  lxc 20161217084041.573 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:983 - Error destroying /sys/fs/cgroup/cpu//lxc/foo
  lxc 20161217084041.575 ERROR lxc_conf - conf.c:userns_exec_1:4334 - Error setting up child mappings
  lxc 20161217084041.575 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:983 - Error destroying /sys/fs/cgroup/freezer//lxc/foo
  lxc 20161217084041.576 ERROR lxc_conf - conf.c:userns_exec_1:4334 - Error setting up child mappings
  lxc 20161217084041.576 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:983 - Error destroying /sys/fs/cgroup/cpuset//lxc/foo
  lxc 20161217084041.578 ERROR lxc_conf - conf.c:userns_exec_1:4334 - Error setting up child mappings
  lxc 20161217084041.578 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:983 - Error destroying /sys/fs/cgroup/blkio//lxc/foo
  lxc 20161217084041.580 ERROR lxc_conf - conf.c:userns_exec_1:4334 - Error setting up child mappings
  lxc 20161217084041.580 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:983 - Error destroying /sys/fs/cgroup/devices//lxc/foo
  lxc 20161217084041.581 ERROR lxc_conf - conf.c:userns_exec_1:4334 - Error setting up child mappings
  lxc 20161217084041.581 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:983 - Error destroying /sys/fs/cgroup/memory//lxc/foo
  lxc 20161217084041.583 ERROR lxc_conf - conf.c:userns_exec_1:4334 - Error setting up child mappings
  lxc 20161217084041.583 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:983 - Error destroying /sys/fs/cgroup/perf_event//lxc/foo

Try `lxc info --show-log foo` for more info

问题:

容器最初启动的主机的一些特定于硬件的信息是否编码在容器的磁盘序列化副本中(例如 RAM,MAC 地址),从而无法在具有略微不同的硬件规格的另一台主机上启动容器?

我还可以通过外部硬盘对便携式容器的使用情况做些什么?

答案1

/etc/subuid我的 2 台主机上的各种登录名的号码/etc/subgid不匹配,因此在最初未创建(或启动)的主机上启动容器时运行时失败。

一旦我使两台主机上的这些文件相同,我就可以正常启动容器。

LxD 开发人员请注意:LxD 提供的更高级别、更用户友好的错误消息,以及对可能原因的提示,将是对这个伟大软件的一个受欢迎的补充!

相关内容