我有伪造文件:
FROM tensorflow/tensorflow:1.5.0-devel-gpu-py3
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app当我建造它时:
sudo docker build -t tf150image .运行容器:
sudo docker run -dt --rm --gpus all -v "$(pwd)":/usr/src/app/ -p 8080:5000 --name tf150container tf150image在容器中运行bash:
sudo docker exec -it tf150container /bin/bash并且希望通过以下方式更新它:
apt update或
apt-get update但它一直保持在0%的水平上。
root@db4002b042a8:/usr/src/app# apt-get update
Get:3 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:5 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial/universe Sources [9802 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [256 kB]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [2051 kB]
Get:12 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [15.9 kB]
Get:13 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [984 kB]
Get:14 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [8820 B]
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/universe Sources [548 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [2560 kB]
Get:19 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [16.4 kB]
Get:20 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [1544 kB]
Get:21 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [26.2 kB]
Get:22 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [10.9 kB]
Get:23 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [12.7 kB]
0% [Working] 我怎么才能解决这个问题?
我已经试过了:
1.
apt-get clean
apt-get update下一次构建映像之前的
sudo docker image prune -a使用在https://repogen.simplylinux.ch/生成的列表替换/etc/apt/.
#------------------------------------------------------------------------------#
# OFFICIAL UBUNTU REPOS #
#------------------------------------------------------------------------------#
###### Ubuntu Main Repos
deb http://pl.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://pl.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
###### Ubuntu Update Repos
deb http://pl.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://pl.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://pl.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://pl.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://pl.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://pl.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://pl.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://pl.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner但它提供了以下输出:
root@db4002b042a8:/usr/src/app# apt-get update
Get:3 http://pl.archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:4 http://pl.archive.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Get:5 http://archive.canonical.com/ubuntu xenial InRelease [11.5 kB]
Get:6 http://pl.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:7 http://pl.archive.ubuntu.com/ubuntu xenial-proposed InRelease [260 kB]
Get:8 http://pl.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:9 http://pl.archive.ubuntu.com/ubuntu xenial/main Sources [1103 kB]
Get:10 http://pl.archive.ubuntu.com/ubuntu xenial/restricted Sources [5179 B]
Get:11 http://pl.archive.ubuntu.com/ubuntu xenial/universe Sources [9802 kB]
Get:12 http://archive.canonical.com/ubuntu xenial/partner Sources [2303 B]
Get:13 http://archive.canonical.com/ubuntu xenial/partner amd64 Packages [2763 B]
Get:14 http://pl.archive.ubuntu.com/ubuntu xenial/multiverse Sources [215 kB]
Get:15 http://pl.archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]
Get:16 http://pl.archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]
Get:17 http://pl.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]
Get:18 http://pl.archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [176 kB]
Get:19 http://pl.archive.ubuntu.com/ubuntu xenial-security/main Sources [311 kB]
Get:20 http://pl.archive.ubuntu.com/ubuntu xenial-security/restricted Sources [3239 B]
Get:21 http://pl.archive.ubuntu.com/ubuntu xenial-security/universe Sources [256 kB]
Get:22 http://pl.archive.ubuntu.com/ubuntu xenial-security/multiverse Sources [4950 B]
Get:23 http://pl.archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages [2051 kB]
Get:24 http://pl.archive.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [15.9 kB]
Get:25 http://pl.archive.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [984 kB]
Get:26 http://pl.archive.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [8820 B]
Get:27 http://pl.archive.ubuntu.com/ubuntu xenial-updates/main Sources [665 kB]
Get:28 http://pl.archive.ubuntu.com/ubuntu xenial-updates/restricted Sources [3941 B]
Get:29 http://pl.archive.ubuntu.com/ubuntu xenial-updates/universe Sources [548 kB]
Get:30 http://pl.archive.ubuntu.com/ubuntu xenial-updates/multiverse Sources [13.5 kB]
Get:31 http://pl.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [2560 kB]
Get:32 http://pl.archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [16.4 kB]
Get:33 http://pl.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [1544 kB]
Get:34 http://pl.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [26.2 kB]
Get:35 http://pl.archive.ubuntu.com/ubuntu xenial-proposed/main Sources [3596 B]
Get:36 http://pl.archive.ubuntu.com/ubuntu xenial-proposed/universe Sources [2526 B]
Get:37 http://pl.archive.ubuntu.com/ubuntu xenial-proposed/main amd64 Packages [31.7 kB]
Get:38 http://pl.archive.ubuntu.com/ubuntu xenial-proposed/universe amd64 Packages [2393 B]
Get:39 http://pl.archive.ubuntu.com/ubuntu xenial-backports/main Sources [7276 B]
Get:40 http://pl.archive.ubuntu.com/ubuntu xenial-backports/universe Sources [12.3 kB]
Get:41 http://pl.archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [10.9 kB]
Get:42 http://pl.archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [12.7 kB]
0% [Working] FROM python:3.6-buster
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app那么我对apt-get更新一点问题都没有。
这很奇怪,因为几个月前,我能够在同一个dockerfile中做到这一点,没有问题。
发布于 2021-09-08 15:12:15
在FROM tensorflow/tensorflow:1.5.0-devel-gpu-py3之后添加这一行是为我做的:
RUN rm /etc/apt/sources.list.d/* && apt clean && apt update最后一个dockerfile应该如下所示:
FROM tensorflow/tensorflow:1.5.0-devel-gpu-py3
RUN rm /etc/apt/sources.list.d/* && apt clean && apt update
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/apphttps://stackoverflow.com/questions/69027635
复制相似问题