docker-compose-postgres.yml
TLDR
This file is a Docker Compose file that sets up a PostgreSQL database container and a dependency container for a Mattermost application.
Services
postgres
This service creates a PostgreSQL container using the postgres:10
image. It is configured with the following properties:
-
restart: always
- The container will automatically restart if it stops for any reason. -
environment
- Defines environment variables for the container, including the PostgreSQL username and password. -
healthcheck
- Performs a health check on the container by runningpg_isready
command. The health check interval is set to 5 seconds, timeout to 10 seconds, and retries to 3. -
tmpfs
- Mounts a temporary file system on the container's/var/lib/postgresql/data
directory. -
ports
- Maps port 44447 on the host to the default PostgreSQL port 5432 on the container.
start_dependencies
This service uses the mattermost/mattermost-wait-for-dep:latest
image. It depends on the postgres
service, so it will wait for the PostgreSQL container to start before executing its command. The command postgres:5432
in this container serves as a placeholder.
version: '2.4'
services:
postgres:
image: "postgres:10"
restart: always
environment:
POSTGRES_USER: mmuser
POSTGRES_PASSWORD: mostest
healthcheck:
test: [ "CMD", "pg_isready", "-h", "localhost" ]
interval: 5s
timeout: 10s
retries: 3
tmpfs: /var/lib/postgresql/data
ports:
- 44447:5432
start_dependencies:
image: mattermost/mattermost-wait-for-dep:latest
depends_on:
- postgres
command: postgres:5432