Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tsamaya/docker-compose-postgis

PostgreSQL/PostGIS & pgAdmin with docker-compose
https://github.com/tsamaya/docker-compose-postgis

Last synced: 4 days ago
JSON representation

PostgreSQL/PostGIS & pgAdmin with docker-compose

Awesome Lists containing this project

README

        

# PostgreSQL/PostGIS & pgAdmin with docker-compose

## Requirements:

- docker >= 18.02.0+

## Quick Start

- clone this repository
- `$ cd path/to/cloned/repo/`
- run `docker-compose up -d`

`PGDATA` is mounted locally in [volumes/pgdata](./volumes/pgdata) and contains the database files.
`pgadmin` is mounted locally in [volumes/pgadmin](./volumes/pgadmin) and contains the pgadmin session configuration files.

## Environment variables

The docker-compose file has the following environment variables:

- `POSTGRES_USER` the default value is **postgres**
- `POSTGRES_PASSWORD` the default value is **SuperSecret**
- `PGADMIN_DEFAULT_EMAIL` the default value is **[email protected]**
- `PGADMIN_DEFAULT_PASSWORD` the default value is **SuperSecret**
- `PGADMIN_LISTEN_PORT` the default value is **49152**

## Usage

### Access to pgAdmin:

- **URL:** [`http://localhost:49152`](http://localhost:49152) (by default)
- **Username:** `[email protected]` (by default)
- **Password:** `SuperSecret` (by default)

### Configure postgres within pgAdmin:

- **Host name/address** `postgres`
- **Port** `5432`
- **Maintenance database** `postgres`
- **Username** as `POSTGRES_USER`, by default: `postgres`
- **Password** as `POSTGRES_PASSWORD`, by default `SuperSecret`

### postgis container acess

Once you have started a database container, you can then connect to the database as follows:

- run `$ docker exec -ti postgres_container /bin/bash`

then the usual `psql`, `pg_restore` comands are available, for instance:

```
root@c01fb351f02c:/# psql -U postgres
psql (12.2 (Debian 12.2-2.pgdg100+1))
Type "help" for help.

postgres=#
```

### Shutdown

- run `$ docker-compose down` from the directory hosting the docker-compose file

### More

For more detailed instructions about how to start and control your Postgres container, see the documentation for the postgres image [here](https://registry.hub.docker.com/_/postgres/).

## Resources

- docker image postgis : https://registry.hub.docker.com/r/postgis/postgis
- docker image for postgres : https://registry.hub.docker.com/_/postgres/
- additional pgAdmin configuration : https://www.pgadmin.org/docs/pgadmin4/latest/container_deployment.html

## License

Licensed under the MIT License

A copy of the license is available in the repository's [LICENSE](LICENSE) file.