所以我想在 centOS 7 Docker 容器中安装并执行一个程序(ESET Endpoint Antivirus)。问题是我在运行之前明显无法安装它
/usr/sbin/init
.RUN /usr/sbin/init
在 Dockerfile 中,而我们应该能够在构建时通过 rpm 安装。这意味着我每次都需要在运行时安装(最多需要 2 分钟),并且由于我需要在每次任务后 --rm
我的容器,所以效率非常低。
如果我尝试使用
rpm -i /eea-9.1.4.0-el7.x86_64.rpm
作为命令参数运行容器,我得到 Failed to create bus connection: No such file or directory
.有问题的部分在这里(
rpm -qp --scripts /eea-9.1.4.0-el7.x86_64.rpm
的输出):
preinstall scriptlet (using /bin/sh):
#!/bin/sh
# Script to be run before package is installed / upgraded
SYSTEMD_CAT="$(which systemd-cat 2>/dev/null || true)"
print_error() {
errorstr="ESET Endpoint Antivirus error: $1"
echo "$errorstr" 1>&2
if [ -n "$SYSTEMD_CAT" ]; then
printf "%s" "$errorstr" | $SYSTEMD_CAT -t "eea" -p err
fi
}
# Check for UTF-8 support
if ! localectl list-locales | grep -i "UTF-8\|UTF8" 1>/dev/null ; then
print_error 'UTF-8 support is not installed in the system. Please install a UTF-8 locale first. Aborting installation.'
exit 1
fi
对
localectl list-locales
的调用返回上述总线错误。
如果我先运行
/usr/sbin/init
然后通过exec
安装一切正常。无需执行脚本即可安装。
rpm --no-scripts -i ...