我正在尝试在 Ubuntu 16.10 上运行 lxc 容器,其配置如下:
lxc.utsname = cont
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = bridge
lxc.network.ipv4 = 10.0.0.10/24
桥接器已经启动并运行。我使用 xenial 模板创建容器,如下所示:
lxc-create -f lxc-veth.conf -t download -n cont -- --dist ubuntu --release xenial --arch amd64 --no-validate
然后我启动容器:
lxc-start -n cont /bin/bash --logfile log.txt
我收到以下错误:
lxc-start 20161114114122.026 ERROR lxc_start - start.c:start:1439 - No such file or directory - failed to exec /lib/lxc cont
lxc-start 20161114124122.026 ERROR lxc_sync - sync.c:__sync_wait:57 - An error occurred in another process (expected sequence number 5)
lxc-start 20161114124122.026 ERROR lxc_start - start.c:__lxc_start:1354 - failed to spawn 'cont'
lxc-start 20161114124127.568 ERROR lxc_start_ui - tools/lxc_start.c:main:344 - The container failed to start.
lxc-start 20161114124127.568 ERROR lxc_start_ui - tools/lxc_start.c:main:346 - To get more details, run the container in foreground mode.
lxc-start 20161114124127.568 ERROR lxc_start_ui - tools/lxc_start.c:main:348 - Additional information can be obtained by setting the --logfile and --logpriority options.
我无法找出哪个文件丢失了。那么问题的根源是什么?
答案1
问题出在最后一条命令上lxc-start
,命令应该是:
lxc-start -n cont --logfile bla.txt -- /bin/bash
基本上不需要运行,/bin/bash
因为当我连接容器时,我将拥有 shell 访问权限