【发布时间】:2017-09-02 07:46:49
【问题描述】:
在带有ubuntu:latest (Xenial) 映像的新 Ubuntu 14.04 机器上执行 apt-get -y upgrade 时,会引发错误:
Setting up makedev (2.3.1-93ubuntu2~ubuntu16.04.1) ...
mv: cannot move 'console-' to 'console': Device or resource busy
makedev console c 5 1 root tty 0600: failed
我在全新的 Ubuntu 14.04 上全新安装了 docker,使用以下命令:
sudo apt-get remove docker docker-engine
sudo apt-get update
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
wget -qO- https://get.docker.com/ | sudo sh
su - $USER # To logout and login
hello-world 的 Docker 运行良好:
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
78445dd45222: Pull complete
Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
当我创建一个空的 docker 容器时:
docker run -it ubuntu bash
并运行以下内容:
apt-get update
apt-get install -y debconf-utils
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
apt-get update
apt-get -y upgrade
错误:
Setting up makedev (2.3.1-93ubuntu2~ubuntu16.04.1) ...
mv: cannot move 'console-' to 'console': Device or resource busy
makedev console c 5 1 root tty 0600: failed
在执行最后一个apt-get -y upgrade时引发
完整的 docker 日志开启:https://gist.github.com/alvations/ebe7175b984213d6f64a3c779ba3249e
【问题讨论】:
-
你真的不应该在容器内调用升级 - 只需下载更新版本的基础映像。
-
不过已经是
ubuntu:latest了。 -
对。因此,要获得更新的版本,您需要在更新图像时执行
docker pull,然后执行您的docker build。 -
除了@AdrianMouat 已经说过的关于发行版升级的最佳实践:我认为升级核心库需要特殊权限(或者甚至不适用于内核)。
makedev大概就是这样一个库。
标签: ubuntu docker device apt-get package-managers