关于ubuntu:使用groovy而不是xenial的Ubuntu 16.04 add-apt-repository的Docker容器

关于ubuntu:使用groovy而不是xenial的Ubuntu 16.04 add-apt-repository的Docker容器

我在 docker 容器中添加 ppa 存储库时遇到问题。容器中的 ubuntu 版本是 16.04,应该是xenial,但是当我使用 添加 ppa 存储库时,add-apt-repository它正在使用groovy。问题是,比特币 ppa 存储库在发布时尚未可用groovy。如何解决这个问题?

这是我的 Dockerfile

FROM ubuntu:16.04
FROM node:12.18.1

RUN apt update && apt dist-upgrade -y
RUN apt install software-properties-common -y
RUN add-apt-repository ppa:bitcoin/bitcoin
RUN apt update

这是错误输出:

Step 5/19 : RUN add-apt-repository ppa:bitcoin/bitcoin
 ---> Running in af0bb3a110cf
 NOT MAINTAINED. The OS-library linking packages here had a series of issues.

PLEASE DOWNLOAD DIRECTLY FROM bitcoincore.org (and verify the signatures of said files).

IF YOU WANT AUTO-UPDATES, please see the officially-maintained snap package -
https://github.com/bitcoin-core/packaging/tree/master/snap
 More info: https://launchpad.net/~bitcoin/+archive/ubuntu/bitcoin
gpg: keybox '/tmp/tmpq1hxj8km/pubring.gpg' created
gpg: key D46F45428842CE5E: 3 signatures not checked due to missing keys
gpg: /tmp/tmpq1hxj8km/trustdb.gpg: trustdb created
gpg: key D46F45428842CE5E: public key "Launchpad PPA for Bitcoin" imported
gpg: no ultimately trusted keys found
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.
Removing intermediate container af0bb3a110cf
 ---> 2949a066b51f
Step 6/19 : RUN apt update
 ---> Running in 2a3109f824ca

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Get:1 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Ign:2 http://deb.debian.org/debian stretch InRelease
Get:3 http://deb.debian.org/debian stretch-updates InRelease [93.6 kB]
Get:4 http://deb.debian.org/debian stretch Release [118 kB]
Get:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [529 kB]
Get:6 http://deb.debian.org/debian stretch-updates/main amd64 Packages [28.2 kB]
Get:7 http://deb.debian.org/debian stretch Release.gpg [2410 B]
Get:8 http://deb.debian.org/debian stretch/main amd64 Packages [7083 kB]
Ign:9 http://ppa.launchpad.net/bitcoin/bitcoin/ubuntu groovy InRelease
Err:10 http://ppa.launchpad.net/bitcoin/bitcoin/ubuntu groovy Release
  404  Not Found
Reading package lists...
E: The repository 'http://ppa.launchpad.net/bitcoin/bitcoin/ubuntu groovy Release' does not have a Release file.
The command '/bin/sh -c apt update' returned a non-zero code: 100

答案1

根据节点 - Docker Hub

... 其中一些标签可能包含 buster、jessie 或 stretch 等名称。这些是 Debian 发行版的套件代号,指示该映像基于哪个发行版。

因此,您实际上是在 Debian 而不是 Ubuntu 上运行 Node。您可以通过运行sudo docker run -it node:12.18.1 /bin/bash然后确认这一点cat /etc/os-release

您尝试安装的存储库和软件包实际上已安装在 Debian 中,因为RUN说明是在之后立即编写的FROM node:12.18.1。要运行在 Ubuntu 映像中添加存储库,请将RUN说明移至下方FROM ubuntu:16.04,即

FROM ubuntu:16.04
RUN apt update && apt dist-upgrade -y
RUN apt install software-properties-common -y
RUN add-apt-repository ppa:bitcoin/bitcoin
RUN apt update

FROM node:12.18.1

相关文档: Dockerfile 参考 | Docker 文档

答案2

虽然与 Docker 或 ubuntu PPA 或奇怪的德比安ubuntu 16.04 输出中的存储库apt update,您可以从bitcoincore.org网站。例如,您可以在docker容器中执行以下操作:

wget https://bitcoincore.org/bin/bitcoin-core-0.20.0/bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
gunzip bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
tar xvf bitcoin-0.20.0-x86_64-linux-gnu.tar
cd bitcoin-0.20.0/bin
./bitcoin-cli "whatever-argument"

相关内容