簡體   English   中英

在 Ubuntu 16.04 docker 映像中安裝 apt-get:'/etc/resolv.conf':設備或資源繁忙

[英]apt-get install in Ubuntu 16.04 docker image: '/etc/resolv.conf': Device or resource busy

在相當普通的 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}"

https://github.com/moby/moby/issues/1297 中所述,您可以Dockerfile添加到您的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 中:

這些行有助於安裝 resolvconf withode debconf 錯誤

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM