首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从AzureDevOps运行Dockerfile时未能从jonathonf存储库获取包

从AzureDevOps运行Dockerfile时未能从jonathonf存储库获取包
EN

Stack Overflow用户
提问于 2019-12-27 14:14:25
回答 2查看 6.3K关注 0票数 0

我有一个Dockerfile,它从一个名为jonathonf的源代码中获取包,但是它无法从这个存储库下载一些包。有人能帮我解决这个问题吗?我很努力地解决这个问题,但我无法解决。

Dockerfile

代码语言:javascript
复制
FROM ubuntu:16.04
LABEL maintainer="Praveen"

# Install Python 3.6, Node & Yarn
RUN apt-get update -y \
  && apt-get install -y software-properties-common curl git \
  && add-apt-repository ppa:jonathonf/python-3.6 \
  #These three lines are added to resolve jonathonf issue
  #&& add-apt-repository ppa:deadsnakes/ppa \
  #&& apt-get update -y \
  #&& apt-get install python3.6 -y \
  #&& apt-get npm \
  #These three lines are added to resolve jonathonf issue
  #&& add-apt-repository ppa:deadsnakes/ppa \
  && curl --silent --location https://deb.nodesource.com/setup_10.x | bash - \
  && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
  && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
  && apt-get update -y \
  && apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv nodejs --no-install-recommends yarn \
  && apt-get clean \
  && python3.6 -m pip install pip --upgrade \
  && python3.6 -m pip install wheel

# Install BigARTM
WORKDIR /tmp
RUN apt-get update -y \
  && apt-get install -y libboost-all-dev python3-setuptools cmake \
  && pip install numpy scipy pandas protobuf==3.0.0 tqdm \
  && git clone --branch=v0.9.0 https://github.com/bigartm/bigartm.git \
  && cd bigartm && mkdir build && cd build \
  && cmake -DPYTHON=python3.6 -DCMAKE_INSTALL_PREFIX=/usr/local .. \
  && make && make install
ENV ARTM_SHARED_LIBRARY=/usr/local/lib/libartm.so

# Install Model
WORKDIR /www
COPY application/python_model/requirements.txt ./python_model/requirements.txt
RUN pip install --no-cache-dir -r ./python_model/requirements.txt \
  && python3.6 -m spacy download en \
  && python3.6 -m nltk.downloader punkt stopwords averaged_perceptron_tagger

# Install NodeJS App
ADD application/package.json application/yarn.lock ./
RUN npm install -g yarn \
  && yarn install \
  && yarn cache clean

ADD application ./

CMD ["yarn", "start"]

错误:

代码语言:javascript
复制
apt-get update
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Ign:2 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial InRelease
Hit:3 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Ign:5 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial Release
Hit:6 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Ign:7 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 Packages
Ign:8 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main all Packages
Ign:7 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 Packages
Ign:8 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main all Packages
Ign:7 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 Packages
Ign:8 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main all Packages
Ign:7 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 Packages
Ign:8 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main all Packages
Ign:7 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 Packages
Ign:8 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main all Packages
Err:7 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 Packages
  403  Forbidden
Ign:8 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main all Packages
Reading package lists...
W: The repository 'http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial Release' does not have a Release file.
E: **Failed to fetch http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu/dists/xenial/main/binary-amd64/Packages  403  Forbidden**
E: Some index files failed to download. They have been ignored, or old ones used instead.
Error executing command, exiting
The command '/bin/sh -c apt-get update -y   && apt-get install -y software-properties-common curl git   && add-apt-repository ppa:jonathonf/python-3.6   && curl --silent --location https://deb.nodesource.com/setup_10.x | bash -   && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -   && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list   && apt-get update -y   && apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv nodejs --no-install-recommends yarn   && apt-get clean   && python3.6 -m pip install pip --upgrade   && python3.6 -m pip install wheel' returned a non-zero code: 1

尝试ubuntu后的错误:18.04

代码语言:javascript
复制
Step 10/22 : ADD application/package.json application/yarn.lock ./
 ---> ba08da3d1daa
Step 11/22 : RUN npm install -g yarn   && yarn install   && yarn cache clean
 ---> Running in 72517b8173b6
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/yarn/bin/yarn.js
npm ERR! dest /usr/bin/yarn
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/yarn/bin/yarn.js' -> '/usr/bin/yarn'
npm ERR! File exists: /usr/bin/yarn
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-12-30T10_10_54_161Z-debug.log
The command '/bin/sh -c npm install -g yarn   && yarn install   && yarn cache clean' returned a non-zero code: 239
##[error]The command '/bin/sh -c npm install -g yarn   && yarn install   && yarn cache clean' returned a non-zero code: 239
##[error]The process '/usr/bin/docker' failed with exit code 239
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-12-31 09:47:47

正如在其他答案中提到的,jonathonf/python3.6ppa 移除,不幸的是,这是在Ubuntu16.04上安装Python3.6的“通常”方式。

如果Ubuntu版本不需要为16.04,则可以使用Ubuntu18.04(仿生)映像(ubuntu:bionicubuntu:18.04)。它已经内置了安装Python3.6的备用apt源代码。

代码语言:javascript
复制
root@2c4e419e7489:/# apt show python3
Package: python3
Version: 3.6.7-1~18.04
Priority: important
Section: python
Source: python3-defaults
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Matthias Klose <doko@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 191 kB
...
APT-Sources: http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
Description: interactive high-level object-oriented language (default python3 version)

root@2c4e419e7489:/# python3 -V
Python 3.6.9

下面是一个使用ubuntu:bionic并安装Python3.6、nodeyarn的工作Dockerfile。注意,我将它分成多个RUN语句,这样我就可以正确地注释掉一些额外的信息。如果你愿意,你可以把它们结合起来。我也不知道你是否还有其他的步骤,但你的帖子只提到了这3步。

代码语言:javascript
复制
FROM ubuntu:bionic
LABEL maintainer="Praveen"

# Install essentials
RUN apt-get update -y \
    && apt-get install -y build-essential software-properties-common curl git

# Install Python 3.6
RUN apt-get install -y python3-pip \
    && apt-get clean \
    && python3 -m pip install --upgrade pip

# Install Node (also installs npm)
#
# Based on official instructions for Ubuntu and Debian
# https://github.com/nodesource/distributions/blob/master/README.md#debinstall
#
# The latest is setup_13.x, but I copied your original command that uses setup10.x.
# It might be better to use setup_13.x instead.
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
    && apt-get install -y nodejs

# Install Yarn
#
# Based on official instructions for Ubuntu and Debian
# https://yarnpkg.com/lang/en/docs/install/#debian-stable
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
    && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
    && apt-get update \
    && apt-get install -y yarn

下面是构建的Docker映像的输出:

代码语言:javascript
复制
root@34c1457911df:/# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"
root@34c1457911df:/# python3 -V
Python 3.6.9
root@34c1457911df:/# python3 -m pip -V
pip 19.3.1 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
root@34c1457911df:/# node --version
v10.18.0
root@34c1457911df:/# npm --version
6.13.4
root@34c1457911df:/# yarn --version
1.21.1

在尝试ubuntu:18.04时收到的已发布的错误消息

代码语言:javascript
复制
Step 11/22 : RUN npm install -g yarn   && yarn install   && yarn cache clean
 ---> Running in 72517b8173b6
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/yarn/bin/yarn.js
npm ERR! dest /usr/bin/yarn
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/yarn/bin/yarn.js' -> '/usr/bin/yarn'
npm ERR! File exists: /usr/bin/yarn

这意味着您已经安装了yarn (可能使用apt install yarn),然后尝试从npm重新安装它。NPM不会覆盖以前的安装,除非您将其--force到。但是,由于您已经从apt安装了它,所以不需要再用npm安装它。(不过,我不使用yarn,所以我不知道yarnapt还是npm有什么不同。)

票数 1
EN

Stack Overflow用户

发布于 2019-12-27 18:10:11

让我向您介绍一下这样的问题是如何自行调试的:

  • 在构建指示403个禁止错误的dockerfile时,您会看到一个错误消息。
  • 该错误为您提供了一个明确的问题来源:包存储库。如果您试图在浏览器中打开URL,您将看到仍然收到403错误。是的,这肯定是包存储库的一个问题。
  • 访问包维护者的根页面将为您提供有关问题来源的更多详细信息:您的dockerfile无效,因为这些包的作者有意不发布它们。

作为抗议大公司滥用开源项目的一部分,这份PPA已被从公众访问中删除。有关更多细节,请访问此处的主页:https://launchpad.net/~jonathonf 如果你是一家公司,你希望这个PPA继续,然后让我知道你的首选捐款路线,我会安排一些事情。 如果我们已经取得联系,然后向我提供您的Launchpad ID,我将在此期间将您添加到私人PPA中。

参考

因此,解决问题的方法是为包找到另一个源,或者与包的作者联系。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59501998

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档