LXC 容器:mktemp:无法通过模板创建文件

LXC 容器:mktemp:无法通过模板创建文件

在一个全新的容器里,我这样做:

lxc-attach -n mycontainer -- apt-get install -y wget

但 wget 的安装部分失败,并显示以下消息

...
Processing triggers for ca-certificates (20160104) ...
mktemp: failed to create file via template ‘/some/path/on/host/machine’: No such file or directory
dpkg: error processing package ca-certificates (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 ca-certificates

答案1

解决方案很简单,就是清除环境变量,如下所示:

lxc-attach --clear-env -n mycontainer -- apt-get install -y wget

lxc-attach --help

  --clear-env   Clear all environment variables before attaching.
                The attached shell/program will start with only
                container=lxc set.
  --keep-env    Keep all current environment variables. This
                is the current default behaviour, but is likely to
                change in the future.

相关内容