postgres: Installation of postgresql-plpython package causes database connection problems
In container like this:
FROM postgres:9.6
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
"postgresql-plpython-$PG_MAJOR"
I could not connect to database, even if I not create a language using CREATE LANGUAGE plpythonu
command.
[mutex@asus]$ (master)$ psql -U postgres -h 127.0.0.1 -p 5432 <dbname>
psql: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
And postgres don’t write any log messages, even in debug log mode. I can suggest, that some process crashes on server side but i don’t know how to trace them.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 19 (7 by maintainers)
Commits related to this issue
- Build my own PostgreSQL image to fix https://github.com/docker-library/postgres/issues/230#issuecomment-343725888 — committed to iplweb/bpp by mpasternak 7 years ago
This is how I install plpython in my image now.
First I tell apt to pin the versions of all the packages installed in the image - obviously, those are versions which were current when the image was built.
Then I do update and install plpython.
If there are any problems with the packages out there, in the repositories, esp. pgdg which may have been already updated by the time I build the image, this will fail at the build stage. This will not pull new PostgreSQL packages thus causing PostgreSQL to listen on another port.
Hi.
I was also affected by this problem.
This problem is caused by installation of PostgreSQL packages from upstream by apt-get, but only during the build phase. If you upgrade postgresql-plpython and postgresql packages later, you should be cool. But this pretty much kills the whole idea of having docker image.
@pensnarik , please watch what happens when you apt-get install postgresql-plpython. This command will probably try to upgrade packages from the base image using apt. This, in turn, will cause connection problems you described. When will it happen? When Debian’s repo has newer versions
At the moment of this writing, PostgreSQL image from docker library has version 9.6.5. Debian upstream has version 9.6.6. No wonder this bug will happened kind of randomly. To my surprise, for me, suddenly continuous integration started to break - in a place that I have not touched at all.
I am working on my solution but it looks like it more and more skews in the “build your own fat image” direction. Which, again, pretty much kills the whole idea of containers for my development.
The other solution would be to upgrade official images to 9.6.6 but I am sure this issue will re-appear some time later.
docker-library devs, please keep this open if you don’t mind.
Another solutions:
@yosifkit what do you mean by this?
I just tried to do the same and it’s still updating the packages, restoring the standard postgresql.conf.sample, effectively restoring listen_addr to default (i.e. localhost). What is the recommended way to install plpython in Docker?