将软件包安装到ubuntu14.04 docker容器中

时间:2016-09-14 14:08:56

标签: docker ubuntu-14.04 init apt-get

我目前正在为开发和制作虚拟盒和数字海洋构建类似的图像(他们使用打包器和ansible来构建)。他们使用的是Ubuntu 14.04。

我从相同的脚本创建了一个docker版本,没有任何问题。这将是一个Gitlab CI环境。

当我在容器内安装软件包时出现错误。可能与破坏的init系统有关?什么东西不运行?

我的初始命令是/sbin/init,我尝试过使用和不使用phusion / base-image。

错误为msg: '/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" install 'docker-engine'' failed: invoke-rc.d: unknown initscript, /etc/init.d/cgroup-lite not found. dpkg: error processing package cgroup-lite (--configure):

(是的,这将是一个单一的容器,而不是单个进程,是的,我正在从它内部运行docker - 我将分享docker.sock以使其工作。)

1 个答案:

答案 0 :(得分:0)

所以,我查看了invoke-rd.d的代码并找到了相关的代码段。

# If we're running on upstart and there's an upstart job of this name, do
# the rest with upstart instead of calling the init script.
if which initctl >/dev/null && initctl version | grep -q upstart \
   && [ -e "$UPSTARTDIR/${INITSCRIPTID}.conf" ]
then
    is_upstart=1
elif test ! -f "${INITDPREFIX}${INITSCRIPTID}" ; then
    ## Verifies if the given initscript ID is known
    ## For sysvinit, this error is critical
    printerror unknown initscript, ${INITDPREFIX}${INITSCRIPTID} not found.
    if [ ! -e "$UPSTARTDIR/${INITSCRIPTID}.conf" ]; then
        # If the init script doesn't exist, but the upstart job does, we
        # defer the error exit; we might be running in a chroot and
        # policy-rc.d might say not to start the job anyway, in which case
        # we don't want to exit non-zero.
        exit 100
    fi
fi

替换init系统的docker,无法在ubuntu docker容器中使用upstart以及为upstart构建的cgroup-lite的ubuntu包的组合意味着dpkg --configure失败,因为服务无法解决开始吧