Issue
I am confronted with a somewhat unexpected problem - I am having problems installing Python 3.8 in a Docker container.
I have created a Dockerfile that is intended to serve as my test DB. As part of its creation, it needs to run a Python script to populate it with test data. However, I cannot do what I thought would be the easiest step: installing 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
Somewhat to my surprise, only Python 3.7 is available through apt-get. The approved method for getting Python 3.8 it to use deadsnakes - but this creates the following errors:
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.
As per various posts I've found, I've added:
RUN apt-get install ca-certificates --yes
RUN gpg-agent --daemon --enable-ssh-support
And although they appear to do no harm (and the latter appears to get rid of a second error message from gpg), they do not solve the problem...
Solution
OK, it seems that installing Python 3.8 (while the latest distribution is Python 3.7) on a debian container is more trouble than it was worth.
My workaround was to create a second Docker container running Python. This populated the Postgres container in a one-off operation.
Answered By - Mike Sadler Answer Checked By - Marilyn (WPSolving Volunteer)