Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

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:

FROM ubuntu:16.04
MAINTAINER Me Myself <[email protected]>
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}"
like image 217
benjist Avatar asked Nov 29 '16 23:11

benjist


People also ask

Where are apt get packages installed Docker?

Packages are installed in the default locations (in this case /usr/lib/). Same place it normally gets installed. Where this is is package dependant.


1 Answers

As mentioned in https://github.com/moby/moby/issues/1297 you can add the following line to your Dockerfile:

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

This way it is possible to install resolvconf inside a container.

like image 51
Christian Berendt Avatar answered Oct 13 '22 22:10

Christian Berendt