我正在尝试从Dockerfile构建映像,并在“ RUN apt-get install ...”时卡住,我想知道原因。我可能不知道是因为GFW。 令我感到困惑的另一件事是,在build中运行时输出的输出日志与在容器中运行时输出的日志不同(即在“ docker container run -it image_name / bin / bash”中运行)。 请帮助我。
我尝试了诸如“ apt-get install sticked”之类的关键字,但没有找到类似的问题。
Dockerfile:
FROM nvidia/cuda:9.0-devel-ubuntu16.04
MAINTAINER avanetten
ENV CUDNN_VERSION 7.3.0.29
LABEL com.nvidia.cudnn.version="${CUDNN_VERSION}"
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-utils \
libcudnn7=$CUDNN_VERSION-1+cuda9.0 \
libcudnn7-dev=$CUDNN_VERSION-1+cuda9.0 && \
apt-mark hold libcudnn7 && \
rm -rf /var/lib/apt/lists/*
我运行这个:
sudo docker build --no-cache -t testimage .
我被困在这里
Sending build context to Docker daemon 2.043GB
Step 1/37 : FROM nvidia/cuda:9.0-devel-ubuntu16.04
---> 2a64416134d8
Step 2/37 : MAINTAINER avanetten
---> Running in 0a0f4e3bb485
Removing intermediate container 0a0f4e3bb485
---> 23c2cb4ab1ff
Step 3/37 : ENV CUDNN_VERSION 7.3.0.29
---> Running in 41b6be7dc176
Removing intermediate container 41b6be7dc176
---> 65f16199d658
Step 4/37 : LABEL com.nvidia.cudnn.version="${CUDNN_VERSION}"
---> Running in 0f5e7aece401
Removing intermediate container 0f5e7aece401
---> c41f04004970
Step 5/37 : RUN apt-get update && apt-get install -y --no-install-recommends apt-utils libcudnn7=$CUDNN_VERSION-1+cuda9.0 libcudnn7-dev=$CUDNN_VERSION-1+cuda9.0 && apt-mark hold libcudnn7 && rm -rf /var/lib/apt/lists/*
---> Running in 3a67681d2578
Get:1 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Ign:3 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 InRelease
Ign:4 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 InRelease
Get:5 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 Release [170 B]
Get:6 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 Release [170 B]
Get:7 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [940 kB]
Get:8 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 Release.gpg [170 B]
Get:9 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:10 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 Release.gpg [170 B]
Get:11 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 Packages [231 kB]
Get:12 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 Packages [54.1 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:14 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [12.7 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]
Get:16 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [582 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]
Get:18 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [6114 B]
Get:19 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]
Get:20 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [176 kB]
Get:21 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [1322 kB]
Get:22 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [13.1 kB]
Get:23 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [986 kB]
Get:24 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [19.1 kB]
Get:25 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [7942 B]
Get:26 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [8807 B]
Fetched 16.3 MB in 28s (570 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
libapt-inst2.0
The following NEW packages will be installed:
apt-utils libapt-inst2.0 libcudnn7 libcudnn7-dev
0 upgraded, 4 newly installed, 0 to remove and 13 not upgraded.
Need to get 242 MB of archives.
After this operation, 598 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libapt-inst2.0 amd64 1.2.32 [55.8 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 apt-utils amd64 1.2.32 [196 kB]
Get:3 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 libcudnn7 7.3.0.29-1+cuda9.0 [126 MB]
^C
我无法从日志中看到进度或速率,然后删除RUN部分并完成图像构建并尝试
docker container run --rm -it testimage /bin/bash
,当容器运行时,我运行以下命令:
apt-get update && apt-get install -y --no-install-recommends \
apt-utils \
libcudnn7=$CUDNN_VERSION-1+cuda9.0 \
libcudnn7-dev=$CUDNN_VERSION-1+cuda9.0 && \
apt-mark hold libcudnn7 && \
rm -rf /var/lib/apt/lists/*
,它有效,日志为
root@74ce912f6318:/# apt-get update && apt-get install -y --no-install-recommends \
> apt-utils \
> libcudnn7=$CUDNN_VERSION-1+cuda9.0 \
> libcudnn7-dev=$CUDNN_VERSION-1+cuda9.0 && \
> apt-mark hold libcudnn7 && \
> rm -rf /var/lib/apt/lists/*
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Ign:4 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 InRelease
Ign:5 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 InRelease
Get:6 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:7 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 Release [170 B]
Get:8 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]
Get:9 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 Release [170 B]
Get:10 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 Release.gpg [170 B]
Get:11 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 Release.gpg [170 B]
Get:12 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 Packages [231 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]
Get:14 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 Packages [54.1 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [176 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [1322 kB]
Get:18 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [940 kB]
Get:19 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [12.7 kB]
Get:20 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [582 kB]
Get:21 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [6114 B]
Ign:22 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
Get:23 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [986 kB]
Get:24 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [19.1 kB]
Get:25 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [7942 B]
Get:26 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [8807 B]
Get:22 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [13.1 kB]
Fetched 16.3 MB in 39s (409 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libapt-inst2.0
The following NEW packages will be installed:
apt-utils libapt-inst2.0 libcudnn7 libcudnn7-dev
0 upgraded, 4 newly installed, 0 to remove and 13 not upgraded.
Need to get 242 MB of archives.
After this operation, 598 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libapt-inst2.0 amd64 1.2.32 [55.8 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 apt-utils amd64 1.2.32 [196 kB]
Get:3 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 libcudnn7 7.3.0.29-1+cuda9.0 [126 MB]
31% [3 libcudnn7 63.8 MB/170 B 37523776%] 8995 kB/s 19s^C
这一次,我可以看到进度(即31%),我可以使用ctrl-c停止该进度。
我有两个期望,首先是使Dockerfile工作,其次是看到进度。谢谢。