Tag: postgresql

Docker PostgreSQL – Scripts in /docker-entrypoint-initdb.d doesn't run

So, I have a docker-compose project with this structure: DockerDev – docker-compose.yaml – d-php – Dockerfile – scripts-apache – d-postgresql – Dockerfile – scripts – dev_data_setup.sql – logs – pgdata – www PHP, Redis, ElasticSearch is OK. But Postgresql doesn’t run dev_data_setup.sql, with any diferent solutions to /dockes-entrypoint-initdb.d that I found (volume, ADD, COPY, etc). […]

Build postgres docker container with initial schema

I’m looking to build dockerfiles that represent company databases that already exist. Similarly, I’d like create a docker file that starts by restoring a psql dump. I have my psql_dump.sql in the . directory. FROM postgres ADD . /init_data run “createdb” “–template=template0” “my_database” run “psql” “-d” “my_database” –command=”create role my_admin superuser” run “psql” “my_database” “<” […]

docker-compose for a pure data container and web server, postgresql

I am using a docker-compose.yml file to build 3 docker containers for my django nginx postgresql and a pure data container. Here is my docker-compose.yml data: # pure data container image: busybox volumes: – /etc/postgresql – /var/log/postgresql:/var/log/postgresql – /var/lib/postgresql – /var/log/nginx:/var/log/nginx – /var/log/supervisor:/var/log/supervisor db: image: postgres volumes_from: – data web: build: . ports: – “80:80” […]

docker-compose: accessing postgres' shell (psql)

I’m trying to access PostgreSQL’s shell (psql) using docker-compose, but I’m having some difficulties… Here’s my docker-compose file: main: build: . volumes: – .:/code links: – postgresdb environment: – DEBUG=true postgresdb: build: utils/sql/ ports: – “5432” environment: – DEBUG=true I’ve tried to access psql by going through the main as well as the postgresdb services, […]

Changing a postgres containers server port in Docker Compose

I am trying to deploy a second database container on a remote server using Docker compose. This postgresql server runs on port 5433 as opposed to 5432 as used by the first postgresql container. When I set up the application I get this error output: web_1 | django.db.utils.OperationalError: could not connect to server: Connection refused […]

Specifying superuser PostgreSQL password for a Docker Container

When running a PostgreSQL database in a Docker container, the documentation for the official PostgreSQL Docker Image specifies that the administrator password should be set in an environmental variable like: docker run –name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres For those that do not want to hard-code a plain-text password in their scripts, are there more […]

How do I create a docker-compose version 2 to have a persistent postgres db using volumes?

I understand that using the older version of docker-compose, we can create another container with just a data volume and link it using volumes_from to make it a “data-only container.” However, I wanted to test out using the new syntax. version: ‘2’ services: app: build: . links: – psql psql: image: postgres volumes_from: – psqldata […]

Docker Backup and restore postgres

I using docker postgres:9.4 image. I need to know how to backup and restore volume only container. Created Volume container: docker run -v /var/lib/postgresql/data –name dbdata postgres:9.4 /bin/true Using the volume docker run –name=postgres –volumes-from=dbdata -d -p 6432:5432 postgres:9.4 Backup Volume container docker run –volumes-from dbdata -v $(pwd):/backup postgres:9.4 tar cvf /backup/backup.tar /var/lib/postgresql/data Restore volume […]

Run postgres container with data volumes through docker-machine

I have an issue with running postgres container with set up volumes for data folder on my Mac OS machine. I tried to run it such like this: docker run \ –name my-postgres \ -e POSTGRES_USER=admin \ -e POSTGRES_PASSWORD=password \ -e POSTGRES_DB=some_db_dev \ -v $PG_LOCAL_DATA:/var/lib/postgresql/data \ -d postgres:9.5.1 Every time I got the following result […]

Extending docker official postgres image

I’m trying to extend the official docker postgres image in order to install a custom python module so I can use it from withing a plpython3 stored procedure. Here’s my dockerfile FROM postgres:9.5 RUN apt-get update && apt-get install -y postgresql-plpython3-9.5 python3 ADD ./repsug/ /opt/smtnel/repsug/ WORKDIR /opt/smtnel/repsug/ RUN [“python3”, “setup.py”, “install”] WORKDIR / My question […]

Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.