简体   繁体   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

I'm getting the error message below when running apt-get install from within a rather vanilla Ubuntu 16.04 image:在相当普通的 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

The packages seem to be installed correctly, though.不过,这些软件包似乎已正确安装。 How to fix it?如何解决?

My Dockerfile looks like this:我的 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}"

As mentioned in https://github.com/moby/moby/issues/1297 you can add the following line to your Dockerfile :https://github.com/moby/moby/issues/1297 中所述,您可以Dockerfile添加到您的Dockerfile

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

This way it is possible to install resolvconf inside a container.这样就可以在容器内安装resolvconf

With the above comment and answer of @Christian Berendt, I still get these errors:根据@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: 

Here is my complete solution, by adding these lines into the Dockerfile:这是我的完整解决方案,将这些行添加到 Dockerfile 中:

These lines help install resolvconf withode debconf errors这些行有助于安装 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.

相关问题 当我尝试在 ubuntu:18.04 中移动 /etc/resolv.conf 时出现“设备或资源繁忙”。 怎么修? - "Device or resource busy" when i try move /etc/resolv.conf in ubuntu:18.04. How fix it? 无法在docker容器中编辑/etc/resolv.conf - unable to edit /etc/resolv.conf in docker container Docker 如何使用 /etc/resolv.conf 中定义的名称服务器启动容器 - Docker how to start container with defined nameservers in /etc/resolv.conf apt-get install Python3 in fresh Ubuntu Docker Image results in Error 13 Permission Denied - apt-get install Python3 in fresh Ubuntu Docker Image results in Error 13 Permission Denied 如何从 docker-compose 文件覆盖 /etc/resolv.conf 中 Docker 的嵌入式 DNS 服务器 - How to override embedded DNS server for Docker in /etc/resolv.conf from a docker-compose file 如何在docker文件或脚本中以非root用户身份修改/etc/resolv.conf - how to modify /etc/resolv.conf as non root user in docker file or as script Docker 在从桥接模式切换到主机模式然后再切换回来时,是否会保留容器中物理 /etc/resolv.conf 中的 resolv.conf? - Does Docker persist the resolv.conf from the physical /etc/resolv.conf in the container when switching from bridge mode to host mode and then back? Ubuntu 22 基础 docker 映像上的 apt-get 更新失败 - apt-get update fails on Ubuntu 22 base docker image Docker 使用主机的 DNS 代替 /etc/resolv.conf 中提到的 DNS - Docker uses the DNS of the host instead of the DNS mentioned in /etc/resolv.conf bash:apt-get:找不到命令(在 ubuntu docker 图像上) - bash: apt-get: command not found (on ubuntu docker image)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM