-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-postgres-test.yml
40 lines (37 loc) · 1.61 KB
/
docker-compose-postgres-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
version: "3.3"
# Source: https://stackoverflow.com/questions/30848670/how-to-customize-the-configuration-file-of-the-official-postgresql-docker-image
services:
# Container for postgres DB.
db:
image: postgres:9.6.1
# Expose DB under :8001.
ports:
- "8001:5432"
# Make Postgres log to a file.
# Tune configuration here.
command: postgres -c shared_buffers=3GB -c effective_cache_size=6GB -c work_mem=150MB -c log_min_error_statement=error -c log_statement='none' -c log_min_duration_statement=-1 -c maintenance_work_mem=2GB -c max_wal_size=2GB -c wal_level=minimal -c archive_mode=off -c max_wal_senders=0 -c max_parallel_workers_per_gather=2
environment:
# Set superuser name.
- POSTGRES_USER=admin
# Provide the password via an environment variable. If the variable is unset or empty, use a default password
- POSTGRES_PASSWORD=password
# Create database.
- POSTGRES_DB=topac
# If on a non-Linux OS, make sure you share the drive used here. Go to Docker's settings -> Shared Drives
volumes:
# Persist the data between container invocations
- postgresVolume:/var/lib/postgresql/data
#- ./logs:/logs
networks:
topac-test-network:
# Our application can communicate with the database using this hostname
aliases:
- topacPostgres
# Create network.
networks:
topac-test-network:
driver: bridge
# Creates a named volume to persist our data. When on a non-Linux OS, the volume's data will be in the Docker VM
# (e.g., MobyLinuxVM) in /var/lib/docker/volumes/
volumes:
postgresVolume: