I am trying to transfer cloud data into a Postgres database from within a Docker container. I built the container using docker-compose
with the following Dockerfile snippet:
FROM postgres:14
...
RUN apt-get update \
&& pip3 install awscli
RUN aws --version
RUN apt-get -y install postgresql-plpython3-14
# symlinks for extension
RUN ln -s /usr/lib/postgresql/plpython3.so /usr/local/lib/postgresql/plpython3.so \
&& ln -s /usr/share/postgresql/extension/plpython3u.control /usr/local/share/postgresql/extension/plpython3u.control \
&& ln -s /usr/share/postgresql/extension/plpython3u--1.0.sql /usr/local/share/postgresql/extension/plpython3u--1.0.sql \
&& ln -s /usr/share/postgresql/extension/plpython3u--unpackaged--1.0.sql /usr/local/share/postgresql/extension/plpython3u--unpackaged--1.0.sql
...
I then run:
$ docker exec -it <container> psql -U postgres -W
and here's the psql:
postgres=# CREATE EXTENSION plpython3u;
ERROR:extension "plpython3u" already exists
postgres=# DROP EXTENSION plpython3u;
ERROR: extension "plpython3u" does not exist
Obviously something is not right, but I have no idea what it is.
I had to rebuild the container to add the symlinks and I used docker-compose build --no-cache
. I tried searching for similar issues, but all I've found are suggestions to add the symlinks, which I have already done.
Thanks.