apt get安装在Ubuntu 16.04 docker镜像中:'/etc/resolv.conf';:设备或资源忙

apt get安装在Ubuntu 16.04 docker镜像中:'/etc/resolv.conf';:设备或资源忙,docker,dockerfile,ubuntu-16.04,Docker,Dockerfile,Ubuntu 16.04,在一个相当普通的Ubuntu 16.04映像中运行apt get install时,我收到以下错误消息: ln: cannot remove '/etc/resolv.conf': Device or resource busy dpkg: error processing package resolvconf (--configure): subprocess installed post-installation script returned error exit status 1 Er

在一个相当普通的Ubuntu 16.04映像中运行apt get install时,我收到以下错误消息:

ln: cannot remove '/etc/resolv.conf': Device or resource busy
dpkg: error processing package resolvconf (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 resolvconf
不过,这些软件包似乎安装正确。如何修复它

我的Dockerfile如下所示:

FROM ubuntu:16.04
MAINTAINER Me Myself <me@myself.com>
RUN apt-get update && apt-get install -y git nano 
RUN apt-get upgrade -y

# set the timezone. Note: there is an Ubuntu 16.04 bug which
# requires this to be done this way: 
# http://stackoverflow.com/questions/40234847/docker-timezone-in-ubuntu-16-04-image/40235306#40235306
RUN ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime && dpkg-reconfigure -f noninteractive tzdata

RUN locale-gen en_US en_US.UTF-8 de_DE.UTF-8
ENV PATH="/opt/xyz/bin:${PATH}"
来自ubuntu:16.04的

我自己
运行apt-get-update&&apt-get-install-y git-nano
运行apt获取升级-y
#设置时区。注意:有一个Ubuntu 16.04错误
#要求以以下方式执行此操作:
# http://stackoverflow.com/questions/40234847/docker-timezone-in-ubuntu-16-04-image/40235306#40235306
运行ln-fs/usr/share/zoneinfo/Europe/Berlin/etc/localtime&&dpkg重新配置-f非交互式tzdata
运行locale gen en_US en_US.UTF-8 de_de.UTF-8
ENV PATH=“/opt/xyz/bin:${PATH}”
如中所述,您可以将以下行添加到您的
Dockerfile

RUN echo "resolvconf resolvconf/linkify-resolvconf boolean false" | debconf-set-selections

通过这种方式,可以在容器中安装
resolvconf

通过上面的注释和@Christian Berendt的回答,我仍然得到以下错误:

debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin: 
以下是我的完整解决方案,通过将以下行添加到Dockerfile中:

这些行有助于安装带有ODE debconf错误的resolvconf

RUN apt-get update    
RUN apt-get install -y apt-utils debconf-utils dialog
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN echo "resolvconf resolvconf/linkify-resolvconf boolean false" | debconf-set-selections
RUN apt-get update
RUN apt-get install -y resolvconf

检查此Docker bug条目:您应该将所有这些放在一个运行命令中,以避免在构建此图像的每个步骤中创建一个层。更好的做法是只包含以下行,在不安装新软件包的情况下禁用交互模式:
ENV DEBIAN_fronternate noninteractive