简体   繁体   English

如何使用 Jfrog Debian 远程仓库作为 Ubuntu package 仓库?

[英]How to use Jfrog Debian remote repo as Ubuntu package repository?

I am working in an inte.net restricted environment and trying to create a docker image for my Azuredevops build agent with certain Software's installed in it.我在 inte.net 受限环境中工作,并尝试为我的 Azuredevops 构建代理创建一个 docker 图像,其中安装了某些软件。 Below is the Dockerfile which I am trying to achieve and there are multiple apt-get install commands to install them.下面是我正在尝试实现的 Dockerfile,并且有多个 apt-get install 命令可以安装它们。 But as inte.net is not enabled directly to ubuntu.archive.com, and mirror repositories, I am blocked with the build.但由于 inte.net 未直接启用 ubuntu.archive.com 和镜像存储库,因此我无法构建。

So as an alternate option, I am trying to use our Private jfrog repository, where the I can create a remote repo to the Debian repository url.因此,作为替代选项,我正在尝试使用我们的私有 jfrog 存储库,我可以在其中创建到 Debian 存储库 url 的远程存储库。

So in Jfrog I created virtual repo called(ubuntu-virtual) and added local (ubuntu-local) and remote (ubuntu-remote) inside it.因此,在 Jfrog 中,我创建了名为(ubuntu-virtual)的虚拟仓库,并在其中添加了本地(ubuntu-local)和远程(ubuntu-remote)。

The ubuntu-remote repo is pointing to http://archive.ubuntu.com/ubuntu and In artifactory, we are able to browse the ubuntu packages eg: https://myrepo/artifactory/ubuntu-virtual/pool/main/ ubuntu-remote repo 指向http://archive.ubuntu.com/ubuntu在 artifactory 中,我们可以浏览 ubuntu 包,例如:https://myrepo/artifactory/ubuntu-virtual/pool/main/

FROM ubuntu:18.04
#2-Enable Ubuntu Packages
COPY ./sources.list /etc/apt/
#3- Install basic Softwares
ENV DEBIAN_FRONTEND=noninteractive
RUN echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes
RUN apt-get update && apt-get install -y --no-install-recommends \
    ca-certificates \
    curl \
    wget \
    jq \
    git \
    iputils-ping \
    libcurl4 \
    libicu60 \
    libunwind8 \
    netcat \
    telnet \
    libssl1.0 \
    python \
    python3 \
    nodejs \
    python3-setuptools \
    python3-pip \
    vim \
    openjdk-11-jdk-headless \
    gnupg \
    make \
    yarn\
    apt-transport-https \
    lsb-release \
  && rm -rf /var/lib/apt/lists/*

Then I locally created a file called source.list and added below lines.然后我在本地创建了一个名为 source.list 的文件并添加了以下行。 Then I tried add the COPY command in dockerfile to place this file in /etc/apt.然后我尝试在 dockerfile 中添加 COPY 命令以将此文件放在 /etc/apt.conf 中。

deb https://myrepo/artifactory/oubuntu-virtual/ stretch main contrib non-free
deb https://myrepo/artifactory/ubuntu-virtual/ stretch-updates main contrib non-free

/etc/apt/sources.list /etc/apt/sources.list

But the Builds are still failing但是构建仍然失败

Step 5/14 : RUN apt-get update && apt-get install -y --no-install-recommends     ca-certificates     curl     wget     jq     git     iputils-ping     libcurl4     libicu60     libunwind8     netcat     telnet     libssl1.0     python     python3     nodejs     python3-setuptools     python3-pip     vim     openjdk-11-jdk-headless     gnupg     make     yarn    apt-transport-https     lsb-release   && rm -rf /var/lib/apt/lists/*
 ---> Running in xxxxxxxxxxxx
Ign:1 https://myrepo/artifactory/ubuntu-virtual stretch InRelease
Ign:2 https://myrepo/artifactory/ubuntu-virtual stretch-updates InRelease
Err:3 https://myrepo/artifactory/ubuntu-virtual stretch Release
  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification.
Err:4 https://myrepo/artifactory/ubuntu-virtual stretch-updates Release
  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. 

Error indicates that the ubuntu client itself unable to trust the certs related to Artifactory URL. Hence, try adding the respective certs to the client (/etc/ssl) or use 'sudo apt install ca-certificates' to update certs.错误表明 ubuntu 客户端本身无法信任与 Artifactory URL 相关的证书。因此,请尝试将相应的证书添加到客户端 (/etc/ssl) 或使用“sudo apt install ca-certificates”来更新证书。 Also we can make use of flag '[trusted=yes]' to trust the https URLs if allowed ie something like below:如果允许,我们也可以使用标志“[trusted=yes]”来信任 https URL,如下所示:

deb [trusted=yes] https://myrepo/artifactory/ubuntu-virtual  stretch Release

There is a thread here with possible reasons and recommendations around the issue. 这里有一个线程,其中包含有关该问题的可能原因和建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM