Ubuntu images on Docker.io
When trying to install node.js into the default official Ubuntu image on Docker the other day I hit a dependency issue. Node.js needs rlwrap, and rlwrap is in the universe repository, which it turns out isn’t part of /etc/apt/sources.list for the 12.04 image:
deb http://archive.ubuntu.com/ubuntu precise main
Things worked using the ubuntu:quantal (== ununtu:12.10) image because that has an expanded sources.list that includes universe and multiverse – a much larger selection of available packages:
deb http://archive.ubuntu.com/ubuntu quantal main universe multiverse
It’s a total mystery to me why that difference should be there.
This specific issue can be fixed with a one line addition to the Dockerfile that adds the universe repository:
RUN sed -i s/main/'main universe'/ /etc/apt/sources.list
I took a look at the stackbrew/ubuntu images, which it turns out have a much more complete and consistent set of sources.list (for all 4 versions that are presently available: 12.04, 12.10, 13.04 and 13.10):
deb http://archive.ubuntu.com/ubuntu version main universe deb http://archive.ubuntu.com/ubuntu version-updates main universe deb http://archive.ubuntu.com/ubuntu version-security main universe
Unfortunately this causes bad things to happen if you run ‘apt-get update && apt-get upgrade -y’:
dpkg: dependency problems prevent configuration of initramfs-tools: initramfs-tools depends on udev (>= 147~-5); however: Package udev is not configured yet. dpkg: error processing initramfs-tools (--configure): dependency problems - leaving unconfigured
There’s really no need for initramfs stuff within a container – so the broader sources.list is causing the container to attempt to do unnatural things.
Dependency management in the current crop of Ubuntu images at hand for Docker.io is a bit of a mess at the moment. It’s not hard to straighten things out, but things that superficially look like they’re doing the right thing can come with unintended consequences that don’t fit well with the containerised approach.
 Here’s the error message:
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: nodejs : Depends: rlwrap but it is not installable
 Make sure there’s an ‘apt-get update’ afterwards
Filed under: Docker | Leave a Comment
Tags: 12.04, 12.10, Docker, Docker.io, Dockerfile, main, node, node.js, precise, quantal, rlwrap, sed, sources.list, Ubuntu, universe