gpt4 book ai didi

运行命令 apt update (tensorflow/tensorflow :1. 5.0-devel-gpu-py3) 时,Docker 容器卡在 0% [Working]

转载 作者:行者123 更新时间:2023-12-04 19:28:17 24 4
gpt4 key购买 nike

我有dockerfile:

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/sources.list :
  • #------------------------------------------------------------------------------#
    # 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 update 完全没有问题。
    这很奇怪,因为几个月前,我已经能够使用相同的 dockerfile 毫无问题地做到这一点。

    最佳答案

    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/app

    关于运行命令 apt update (tensorflow/tensorflow :1. 5.0-devel-gpu-py3) 时,Docker 容器卡在 0% [Working],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69027635/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com