Ubuntu的apt-get仓库发生错误 gpg: no valid OpenPGP data found

4

我正在尝试在docker镜像上安装tesseract库,但是出现了错误。

我知道很多人已经问了同样的问题,并且我尝试了许多解决方案,但仍然出现错误。这里是Docker文件:

FROM python:3.7.6
RUN file="$(apt-get update && \
            apt-get install -y apt-utils && \
            apt-get install -y curl && \
            apt-get update && \
            apt-get install -y software-properties-common && \
            apt-get update && \
            apt-key adv --keyserver keyserver.ubuntu.com --recv-keys  A4BCBD87CEF9E52D && \ # this line added after search
            add-apt-repository ppa:alex-p/tesseract-ocr -y )" && echo $file

RUN file = "$(apt-get update  --allow-unauthenticated && \
            apt install tesseract-ocr=4.1.1-1ppa1~xenial1 -y )" && echo "------ New line" && echo $file

输出结果:

Warning: apt-key output should not be parsed (stdout is not a terminal)
gpg: key A4BCBD87CEF9E52D: public key "Launchpad PPA for Alex_P" imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg: keybox '/tmp/tmpqo2rec69/pubring.gpg' created
gpg: /tmp/tmpqo2rec69/trustdb.gpg: trustdb created
gpg: key A4BCBD87CEF9E52D: public key "Launchpad PPA for Alex_P" imported
gpg: Total number processed: 1
gpg:               imported: 1
Warning: apt-key output should not be parsed (stdout is not a terminal)
gpg: no valid OpenPGP data found.

然后它会打印一些已安装的库,接着会出现这个错误信息

step : RUN file = "$(apt-get update  --allow-unauthenticated &&        
     apt install tesseract-ocr=4.1.1-1ppa1~xenial1 -y )" && 
echo "------ New line" && echo $file
 ---> Running in 8d364f24dfd9
E: The repository 'http://ppa.launchpad.net/alex-p/tesseract-ocr/ubuntu focal Release' does not have a Release file.
=:  

请查看这里,这是您问题的答案:https://askubuntu.com/questions/1054697/gpg-no-valid-openpgp-data-found-in-ubuntu - Arpit Jain
@ArpitJain 我已经检查过了,但我不知道应该在这里添加什么 echo -e "deb http://ppa.launchpad.net/ethereum/ethereum/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/[-->在这里:ethereum-ubuntu-ethereum-xenial.list] - shrouk mansour
2个回答

1
根据我的了解,您使用的 Python 3.7.6 的 Docker 镜像是基于 Debian 10 而不是 Ubuntu 16.04(xenial)。您尝试添加的存储库 (ppa:alex-p/tesseract-ocr) 是针对 Ubuntu 的 (https://launchpad.net/~alex-p/+archive/ubuntu/tesseract-ocr)。因此,尝试使用 Ubuntu 16.04(xenial)版本(4.1.1-1ppa1~xenial1)安装 tesseract 注定会失败,因为它是基于 Debian 的镜像。
您需要安装 Debian 包 (https://tracker.debian.org/pkg/tesseract)。我尝试了下面的 Dockerfile,并使用了版本 4.0.0-2 的 tesseract,它可以正常工作。
FROM python:3.7.6
RUN file="$(apt-get update && \
            apt-get install -y apt-utils && \
            apt-get install -y curl && \
            apt-get update && \
            apt-get install -y software-properties-common && \
            apt-get update && \
            apt install tesseract-ocr=4.0.0-2 -y )" && echo $file

检查创建的图像后,我确认tesseract已经安装。

# docker run -it 37755343ba30 bash
root@fdb06d9bdc4e:/# dpkg -l | grep tesseract
ii  libtesseract4:amd64                4.0.0-2                     amd64        Tesseract OCR library
ii  tesseract-ocr                      4.0.0-2                     amd64        Tesseract command line OCR tool
ii  tesseract-ocr-eng                  1:4.00~git30-7274cfa-1      all          tesseract-ocr language files for English
ii  tesseract-ocr-osd                  1:4.00~git30-7274cfa-1      all          tesseract-ocr language files for script and orientation
root@fdb06d9bdc4e:/# exit

希望这回答了你的问题。

这安装的是tesseract 4,我需要的是tesseract 4.1版本。 - shrouk mansour

1
我做了很多搜索,最终通过使用Ubuntu基础映像并在其上安装Python 3.7来解决了问题。正如@Amitp的回答所述,Python基础映像基于Debian而不是Ubuntu,而该PPA正在使用Ubuntu。这是解决方案的Docker文件。
FROM ubuntu:16.04
USER root
RUN file="$(apt-get update && \
            apt-get install -y apt-utils && \
            apt-get install -y curl && \
            apt-get update && \
            apt-get install -y software-properties-common && \
            apt-get update && \
            add-apt-repository ppa:deadsnakes/ppa -y && \
            apt update && \
            apt install -y python3.7 && \
            curl https://bootstrap.pypa.io/get-pip.py | python3.7 &&\
            apt-get update)" && echo $file


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接