Device or resource busy - Docker Device or resource busy - Docker docker docker

Device or resource busy - Docker


Agree with other answers/comments that apt-get -y upgrade isn't as good an idea as pulling a newer/updated image. Where a particular package is required but out of date in an image, installing that particular package is often enough (since dependencies will be updated as necessary).

However, there really is no reason that you shouldnt be able to use apt-get -y upgrade and in fact, I'd consider this a bug, similar to but not exactly the same as:

https://bugs.launchpad.net/ubuntu/+source/makedev/+bug/1675163

The part that is failing is the first call to MAKEDEV in the postinst script but this is handled and the script continues. Ultimately this means there is no current issue with installing makedev. But this may not always be true so probably requires a bug to be raised with Ubuntu to have docker containers detected as well (somehow).

Note: if you care about makedev ruining your docker /dev/ directory currently or want to make sure you get rid of any error condition from installing makedev, the fix for the bug I linked to can be used to trick the postinstall script into not running. The check in the script says:

# don't stomp on LXC usersif grep -q container=lxc /proc/1/environthen    echo "LXC container detected, aborting due to LXC managed /dev."    exit 0fi

so if you were to add an environment variable whose name ends in container with the value lxc, then the check would be tripped and no new devices would be installed

docker run -ti -e "ImNotAnLXCcontainer=lxc" ubuntu

This will cause the script to exit, not create a whole bunch of /dev/ entries, and output the message:

Setting up makedev (2.3.1-93ubuntu2~ubuntu16.04.1) ...LXC container detected, aborting due to LXC managed /dev.


Docker containers aren't full VMs. They share the kernel with the host, so it's not surprising that some low-level operations, such as making devices, will fail. However, I do note that the command doesn't fail despite the error message - the command returns 0. I would suggest that the container actually works as expected.

Despite this, the best answer is simply not to run apt-get upgrade. You're using the ubuntu:latest image, which is kept up-to-date by Docker with new versions. So, rather than do apt-get upgrade to get a new version, just do docker pull ubuntu:latest.

You can check when the latest image was last updated here https://github.com/docker-library/repo-info/blob/master/repos/ubuntu/remote/latest.md. At the time of writing, the last update was over 6 weeks ago, so it will be missing some updates. Whilst I'm disappointed that it's not more up-to-date, I would still recommend against running upgrade as you are likely to have problems and are moving the responsibility for updates onto yourself. Please open an issue if there is an important update that is missing.

I do note that the debian image seems to be kept more up-to-date, probably because it is used as a base image for many of the official images - I would recommend using this if possible.