postgresql-container | PostgreSQL container images based on Red Hat Software | Continuous Deployment library
kandi X-RAY | postgresql-container Summary
kandi X-RAY | postgresql-container Summary
PostgreSQL container images based on Red Hat Software Collections and intended for OpenShift and general usage. Users can choose between Red Hat Enterprise Linux, Fedora, and CentOS based images.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of postgresql-container
postgresql-container Key Features
postgresql-container Examples and Code Snippets
Community Discussions
Trending Discussions on postgresql-container
QUESTION
I want to build postgres docker container for testing some issue. I have:
Archived folder of postgres files(
/var/lib/postgres/data/
)Dockerfile that place folder into doccker postgres:latest.
I want:
Docker image that reset self-state after recreate image.
Container that have database state based on passed into the container postgres files
I don't want to wait for a long time operation of backup and restore existing database in
/docker-entrypoint-initdb.d
initialization script.I DON'T WANT TO USE VOLUMES because I don't need to store new data between restart (That's why this post is different from How to use a PostgreSQL container with existing data?. In that post volumes are used)
My suggestion is to copy postgres files(/var/lib/postgres/data/
) from host machine into docker's /var/lib/postgres/data/
in build phase.
But postgres docker replace this files when initdb phase is executing.
How to ask Postgres docker not overriding database files?
e.g. Dockerfile
...ANSWER
Answered 2019-Sep-04 at 06:49If you don't really need to create a custom image with the database snapshot you could use volumes. Un-tar the database files somewhere on the host say ~/pgdata
then run the image. Example:
QUESTION
I am using the "plain" postgresql:alpine docker image, but have to schedule a database backup daily. I think this is a pretty common task.
I created a script backup
and stored in the container in /etc/periodic/15min
, and made it executable:
ANSWER
Answered 2018-Mar-04 at 17:19I had the exact same problem a few month ago. The key aspect is that a container can have only one main process defined by the ENTRYPOINT
and/or CMD
in your Dockerfile
.
You cannot just swap out postgres
with crond
otherwise your database isn't running. It is generally recommended to separate areas of concern by using one service per container.
With that in mind either use a separate container which runs nothing but crond
and thus Docker
can both track its lifecycle, and restart it when/if it fails, the machine restarts, etc.
Or run the jobs via cron
on your host using docker exec
.
The third and in my opinion best (but also advanced) solution is pg_cron
. It is an postgres
extension and therefore runs the jobs in the same database container. Your challenge would be to adapt the configuration and installation of it.
The easy part should be the
postgresql.conf
:
QUESTION
I'm using this Dockerfile
to deploy it on openshift. - https://github.com/sclorg/postgresql-container/tree/master/9.5
It works fine, until I enabled ssl=on
and injected the server.crt
and server.key
file into the postgres pod via volume mount option.
Secret is created like
...ANSWER
Answered 2017-Jul-27 at 15:08It looks like this is not trivial, as it requires to set Volume Security Context so all the containers in the pod are run as a certain user https://docs.openshift.com/enterprise/3.1/install_config/persistent_storage/pod_security_context.html
In the Kubernetes projects, this is something that is still under discussion https://github.com/kubernetes/kubernetes/issues/2630, but seems that you may have to use Security Contexts and PodSecurityPolicies in order to make it work.
I think the easiest option (without using the above) would be to use a container entrypoint that, before actually executing PostgreSQL, it chowns the files to the proper user (postgres in this case).
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install postgresql-container
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page