Docker 构建 Input/Output 错误
Docker build Input/Output error
我对 docker 很陌生,所以我确定我犯了一些愚蠢的错误。
我正在尝试使用 docker 来设置一个环境,其中包含我为 C++ 安装的所需库和依赖项。但是,我似乎无法构建 VM。
我在运行宁OSXYosemite,我的安装过程如下:
$ brew cask install virtualbox
$ brew install docker-machine
$ docker-machine create --driver virtualbox default
$ eval "$(docker-machine env default)"
我已经能够成功运行几个例子来验证。但是,我不能 运行 以下 MWE Dockerfile:
FROM buildpack-deps:jessie-scm
RUN apt-get update && apt-get install -y --no-install-recommends \
libboost-dev
我得到以下信息:
$ docker build .
docker build .
Sending build context to Docker daemon 2.048 kB
Step 0 : FROM buildpack-deps:jessie-scm
---> a0b6d62d8b49
Step 1 : RUN apt-get update && apt-get install -y --no-install-recommends libboost-dev
---> Running in d0dc09b47dac
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Get:2 http://security.debian.org jessie/updates/main amd64 Packages [172 kB]
Get:3 http://httpredir.debian.org jessie InRelease [134 kB]
Get:4 http://httpredir.debian.org jessie-updates InRelease [123 kB]
Get:5 http://httpredir.debian.org jessie/main amd64 Packages [9038 kB]
Get:6 http://httpredir.debian.org jessie-updates/main amd64 Packages [3614 B]
Fetched 9534 kB in 8s (1183 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
libasan0 libatomic1 libboost1.55-dev libc-dev-bin libc6-dev libgcc-4.8-dev
libgomp1 libitm1 libquadmath0 libstdc++-4.8-dev libtsan0 linux-libc-dev
Suggested packages:
libboost-doc libboost1.55-doc libboost-atomic1.55-dev
libboost-chrono1.55-dev libboost-context1.55-dev libboost-coroutine1.55-dev
libboost-date-time1.55-dev libboost-exception1.55-dev
libboost-filesystem1.55-dev libboost-graph1.55-dev
libboost-graph-parallel1.55-dev libboost-iostreams1.55-dev
libboost-locale1.55-dev libboost-log1.55-dev libboost-math1.55-dev
libboost-mpi1.55-dev libboost-mpi-python1.55-dev
libboost-program-options1.55-dev libboost-python1.55-dev
libboost-random1.55-dev libboost-regex1.55-dev
libboost-serialization1.55-dev libboost-signals1.55-dev
libboost-system1.55-dev libboost-test1.55-dev libboost-thread1.55-dev
libboost-timer1.55-dev libboost-wave1.55-dev libboost1.55-tools-dev
libmpfrc++-dev libntl-dev glibc-doc libstdc++-4.8-doc
Recommended packages:
manpages-dev
The following NEW packages will be installed:
libasan0 libatomic1 libboost-dev libboost1.55-dev libc-dev-bin libc6-dev
libgcc-4.8-dev libgomp1 libitm1 libquadmath0 libstdc++-4.8-dev libtsan0
linux-libc-dev
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 12.3 MB of archives.
After this operation, 132 MB of additional disk space will be used.
Get:1 http://security.debian.org/ jessie/updates/main linux-libc-dev amd64 3.16.7-ckt11-1+deb8u3 [995 kB]
Get:2 http://httpredir.debian.org/debian/ jessie/main libasan0 amd64 4.8.4-1 [63.3 kB]
Get:3 http://httpredir.debian.org/debian/ jessie/main libatomic1 amd64 4.9.2-10 [8992 B]
Get:4 http://httpredir.debian.org/debian/ jessie/main libgomp1 amd64 4.9.2-10 [37.8 kB]
Get:5 http://httpredir.debian.org/debian/ jessie/main libitm1 amd64 4.9.2-10 [29.2 kB]
Get:6 http://httpredir.debian.org/debian/ jessie/main libquadmath0 amd64 4.9.2-10 [129 kB]
Get:7 http://httpredir.debian.org/debian/ jessie/main libtsan0 amd64 4.9.2-10 [212 kB]
Get:8 http://httpredir.debian.org/debian/ jessie/main libgcc-4.8-dev amd64 4.8.4-1 [1689 kB]
Get:9 http://httpredir.debian.org/debian/ jessie/main libc-dev-bin amd64 2.19-18 [237 kB]
Get:10 http://httpredir.debian.org/debian/ jessie/main libc6-dev amd64 2.19-18 [2003 kB]
Get:11 http://httpredir.debian.org/debian/ jessie/main libstdc++-4.8-dev amd64 4.8.4-1 [1053 kB]
Get:12 http://httpredir.debian.org/debian/ jessie/main libboost1.55-dev amd64 1.55.0+dfsg-3 [5818 kB]
Get:13 http://httpredir.debian.org/debian/ jessie/main libboost-dev amd64 1.55.0.2 [3368 B]
/bin/sh: 1: /usr/sbin/dpkg-preconfigure: Input/output error
Fetched 12.3 MB in 6s (1797 kB/s)
dpkg: error: error opening configuration directory '/etc/dpkg/dpkg.cfg.d': Input/output error
E: Directory '/var/log/apt/' missing
E: Sub-process /usr/bin/dpkg returned an error code (2)
E: Failed to write temporary StateFile /var/lib/apt/extended_states.tmp
The command '/bin/sh -c apt-get update && apt-get install -y --no-install-recommends libboost-dev' returned a non-zero code: 100
此外,一旦出现此错误,似乎守护程序已崩溃
$ docker run hello-world
Error response from daemon: open
/mnt/sda1/var/lib/docker/repositories-aufs: no such file or directory
$ docker-machine stop default
$ docker-machine start default
Starting VM...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
$ docker run hello-world
Hello from Docker.
...
可能导致这些 input/output 错误的原因是什么?
Docker 在 OS X 上的安装现在由最近发布的 Docker Toolbox 工具处理。
您应该使用该工具箱,因为它会为您安装和配置 Docker 依赖项
好吧,我已经解决了这个问题(有点),但似乎潜在的问题还没有解决。
回答问题:根本原因似乎是与 Debian 的软件包存储库发生冲突。
我将基本图像从 buildpacks:jessie-scm
更改为 buildpacks:trusty
。我什至在使用 docker 的基础 debian 软件包时遇到了一系列问题,使用以下命令失败:
docker run debian:jessie sh -c "apt-get update && apt-get install -y cmake"
或
docker run debian:wheezy sh -c "apt-get clean && apt-get update && apt-get install -y cmake"
转移到 Ubuntu 似乎解决了这个问题,所以它看起来可能与 Debian 的包存储库有冲突。我可以尝试修复它,但 Ubuntu 可以很好地满足我的目的(甚至可能更可取)。
我对 docker 很陌生,所以我确定我犯了一些愚蠢的错误。
我正在尝试使用 docker 来设置一个环境,其中包含我为 C++ 安装的所需库和依赖项。但是,我似乎无法构建 VM。
我在运行宁OSXYosemite,我的安装过程如下:
$ brew cask install virtualbox
$ brew install docker-machine
$ docker-machine create --driver virtualbox default
$ eval "$(docker-machine env default)"
我已经能够成功运行几个例子来验证。但是,我不能 运行 以下 MWE Dockerfile:
FROM buildpack-deps:jessie-scm
RUN apt-get update && apt-get install -y --no-install-recommends \
libboost-dev
我得到以下信息:
$ docker build .
docker build .
Sending build context to Docker daemon 2.048 kB
Step 0 : FROM buildpack-deps:jessie-scm
---> a0b6d62d8b49
Step 1 : RUN apt-get update && apt-get install -y --no-install-recommends libboost-dev
---> Running in d0dc09b47dac
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Get:2 http://security.debian.org jessie/updates/main amd64 Packages [172 kB]
Get:3 http://httpredir.debian.org jessie InRelease [134 kB]
Get:4 http://httpredir.debian.org jessie-updates InRelease [123 kB]
Get:5 http://httpredir.debian.org jessie/main amd64 Packages [9038 kB]
Get:6 http://httpredir.debian.org jessie-updates/main amd64 Packages [3614 B]
Fetched 9534 kB in 8s (1183 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
libasan0 libatomic1 libboost1.55-dev libc-dev-bin libc6-dev libgcc-4.8-dev
libgomp1 libitm1 libquadmath0 libstdc++-4.8-dev libtsan0 linux-libc-dev
Suggested packages:
libboost-doc libboost1.55-doc libboost-atomic1.55-dev
libboost-chrono1.55-dev libboost-context1.55-dev libboost-coroutine1.55-dev
libboost-date-time1.55-dev libboost-exception1.55-dev
libboost-filesystem1.55-dev libboost-graph1.55-dev
libboost-graph-parallel1.55-dev libboost-iostreams1.55-dev
libboost-locale1.55-dev libboost-log1.55-dev libboost-math1.55-dev
libboost-mpi1.55-dev libboost-mpi-python1.55-dev
libboost-program-options1.55-dev libboost-python1.55-dev
libboost-random1.55-dev libboost-regex1.55-dev
libboost-serialization1.55-dev libboost-signals1.55-dev
libboost-system1.55-dev libboost-test1.55-dev libboost-thread1.55-dev
libboost-timer1.55-dev libboost-wave1.55-dev libboost1.55-tools-dev
libmpfrc++-dev libntl-dev glibc-doc libstdc++-4.8-doc
Recommended packages:
manpages-dev
The following NEW packages will be installed:
libasan0 libatomic1 libboost-dev libboost1.55-dev libc-dev-bin libc6-dev
libgcc-4.8-dev libgomp1 libitm1 libquadmath0 libstdc++-4.8-dev libtsan0
linux-libc-dev
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 12.3 MB of archives.
After this operation, 132 MB of additional disk space will be used.
Get:1 http://security.debian.org/ jessie/updates/main linux-libc-dev amd64 3.16.7-ckt11-1+deb8u3 [995 kB]
Get:2 http://httpredir.debian.org/debian/ jessie/main libasan0 amd64 4.8.4-1 [63.3 kB]
Get:3 http://httpredir.debian.org/debian/ jessie/main libatomic1 amd64 4.9.2-10 [8992 B]
Get:4 http://httpredir.debian.org/debian/ jessie/main libgomp1 amd64 4.9.2-10 [37.8 kB]
Get:5 http://httpredir.debian.org/debian/ jessie/main libitm1 amd64 4.9.2-10 [29.2 kB]
Get:6 http://httpredir.debian.org/debian/ jessie/main libquadmath0 amd64 4.9.2-10 [129 kB]
Get:7 http://httpredir.debian.org/debian/ jessie/main libtsan0 amd64 4.9.2-10 [212 kB]
Get:8 http://httpredir.debian.org/debian/ jessie/main libgcc-4.8-dev amd64 4.8.4-1 [1689 kB]
Get:9 http://httpredir.debian.org/debian/ jessie/main libc-dev-bin amd64 2.19-18 [237 kB]
Get:10 http://httpredir.debian.org/debian/ jessie/main libc6-dev amd64 2.19-18 [2003 kB]
Get:11 http://httpredir.debian.org/debian/ jessie/main libstdc++-4.8-dev amd64 4.8.4-1 [1053 kB]
Get:12 http://httpredir.debian.org/debian/ jessie/main libboost1.55-dev amd64 1.55.0+dfsg-3 [5818 kB]
Get:13 http://httpredir.debian.org/debian/ jessie/main libboost-dev amd64 1.55.0.2 [3368 B]
/bin/sh: 1: /usr/sbin/dpkg-preconfigure: Input/output error
Fetched 12.3 MB in 6s (1797 kB/s)
dpkg: error: error opening configuration directory '/etc/dpkg/dpkg.cfg.d': Input/output error
E: Directory '/var/log/apt/' missing
E: Sub-process /usr/bin/dpkg returned an error code (2)
E: Failed to write temporary StateFile /var/lib/apt/extended_states.tmp
The command '/bin/sh -c apt-get update && apt-get install -y --no-install-recommends libboost-dev' returned a non-zero code: 100
此外,一旦出现此错误,似乎守护程序已崩溃
$ docker run hello-world
Error response from daemon: open /mnt/sda1/var/lib/docker/repositories-aufs: no such file or directory
$ docker-machine stop default
$ docker-machine start default
Starting VM...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
$ docker run hello-world
Hello from Docker.
...
可能导致这些 input/output 错误的原因是什么?
Docker 在 OS X 上的安装现在由最近发布的 Docker Toolbox 工具处理。
您应该使用该工具箱,因为它会为您安装和配置 Docker 依赖项
好吧,我已经解决了这个问题(有点),但似乎潜在的问题还没有解决。
回答问题:根本原因似乎是与 Debian 的软件包存储库发生冲突。
我将基本图像从 buildpacks:jessie-scm
更改为 buildpacks:trusty
。我什至在使用 docker 的基础 debian 软件包时遇到了一系列问题,使用以下命令失败:
docker run debian:jessie sh -c "apt-get update && apt-get install -y cmake"
或
docker run debian:wheezy sh -c "apt-get clean && apt-get update && apt-get install -y cmake"
转移到 Ubuntu 似乎解决了这个问题,所以它看起来可能与 Debian 的包存储库有冲突。我可以尝试修复它,但 Ubuntu 可以很好地满足我的目的(甚至可能更可取)。