使用 postgres Docker 容器安装 Python 3.8
Installing Python 3.8 from with a postgres Docker container
我遇到了一个有点意外的问题 - 我在 Docker 容器中安装 Python 3.8 时遇到问题。
我创建了一个 Docker 文件用作我的测试数据库。作为其创建的一部分,它需要 运行 一个 Python 脚本来用测试数据填充它。但是,我无法执行我认为最简单的步骤:安装 Python.
FROM postgres
# Install Python dependencies ---------
RUN apt-get update && apt dist-upgrade -y
RUN apt install software-properties-common --yes
RUN apt-get install ca-certificates --yes
RUN gpg-agent --daemon --enable-ssh-support
RUN add-apt-repository ppa:deadsnakes/ppa --yes
RUN apt install python3.8 --yes
RUN python3.8 --version
令我有些吃惊的是,只有 Python 3.7 可以通过 apt-get 获得。获得 Python 3.8 以使用 deadsnakes 的批准方法 - 但这会产生以下错误:
Step 12/33 : RUN add-apt-repository ppa:deadsnakes/ppa --yes
---> Running in 17d490c0b568
gpg: keybox '/tmp/tmp8n9r_96q/pubring.gpg' created
gpg: /tmp/tmp8n9r_96q/trustdb.gpg: trustdb created
gpg: key BA6932366A755776: public key "Launchpad PPA for deadsnakes" 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.
根据我发现的各种帖子,我添加了:
RUN apt-get install ca-certificates --yes
RUN gpg-agent --daemon --enable-ssh-support
虽然它们似乎没有害处(后者似乎消除了来自 gpg 的第二条错误消息),但它们并没有解决问题...
好吧,似乎在 debian 容器上安装 Python 3.8(而最新的发行版是 Python 3.7)比它值得的麻烦多了。
我的解决方法是创建第二个 Docker 容器 运行 Python。这在 one-off 操作中填充了 Postgres 容器。
我遇到了一个有点意外的问题 - 我在 Docker 容器中安装 Python 3.8 时遇到问题。
我创建了一个 Docker 文件用作我的测试数据库。作为其创建的一部分,它需要 运行 一个 Python 脚本来用测试数据填充它。但是,我无法执行我认为最简单的步骤:安装 Python.
FROM postgres
# Install Python dependencies ---------
RUN apt-get update && apt dist-upgrade -y
RUN apt install software-properties-common --yes
RUN apt-get install ca-certificates --yes
RUN gpg-agent --daemon --enable-ssh-support
RUN add-apt-repository ppa:deadsnakes/ppa --yes
RUN apt install python3.8 --yes
RUN python3.8 --version
令我有些吃惊的是,只有 Python 3.7 可以通过 apt-get 获得。获得 Python 3.8 以使用 deadsnakes 的批准方法 - 但这会产生以下错误:
Step 12/33 : RUN add-apt-repository ppa:deadsnakes/ppa --yes
---> Running in 17d490c0b568
gpg: keybox '/tmp/tmp8n9r_96q/pubring.gpg' created
gpg: /tmp/tmp8n9r_96q/trustdb.gpg: trustdb created
gpg: key BA6932366A755776: public key "Launchpad PPA for deadsnakes" 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.
根据我发现的各种帖子,我添加了:
RUN apt-get install ca-certificates --yes
RUN gpg-agent --daemon --enable-ssh-support
虽然它们似乎没有害处(后者似乎消除了来自 gpg 的第二条错误消息),但它们并没有解决问题...
好吧,似乎在 debian 容器上安装 Python 3.8(而最新的发行版是 Python 3.7)比它值得的麻烦多了。
我的解决方法是创建第二个 Docker 容器 运行 Python。这在 one-off 操作中填充了 Postgres 容器。