Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lus/nicegres
A simple postgres Docker image with initial users and databases
https://github.com/lus/nicegres
database docker init initialization postgres setup user
Last synced: 7 days ago
JSON representation
A simple postgres Docker image with initial users and databases
- Host: GitHub
- URL: https://github.com/lus/nicegres
- Owner: lus
- License: mit
- Created: 2021-02-14T16:33:19.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-06-04T10:30:44.000Z (over 3 years ago)
- Last Synced: 2024-08-01T13:38:33.767Z (3 months ago)
- Topics: database, docker, init, initialization, postgres, setup, user
- Language: Shell
- Homepage:
- Size: 5.86 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nicegres
nicegres will let you create postgres Docker containers with initial databases and users created.
This will allow you using the same container for many applications with different databases to not use the superuser created by default.## How does it work?
Simply define the `POSTGRES_SETUPS` environment variable like this: `user:pass,user2:pass2`.
This will create the users **and** databases `user` and `user2` with their given passwords, every user being granted all permissions to his corresponding database.You may also skip defining the password part to use the remaining value for the username, password and database name.
If you want a database to be created with another name than the corresponding user has, you can specify a third value: `user:pass:db`.
This will use `db` as the database name assigned to the user `user` with the password `pass`.As you may have noticed above, multiple setups can be used by separating them with a comma (`,`).
### Example
```shell
docker run -d \
-p 5432:5432 \
--name nicegres \
-e POSTGRES_PASSWORD="superuser_password" \
-e POSTGRES_SETUPS="user1:pass1:db1,user2:pass2,user3" \
ghcr.io/lus/nicegres:latest
```**NOTE:** This feature will **not** let you bypass the requirement of a `POSTGRES_PASSWORD` variable used for the superuser!
## The built image is old / Postgres got an update. What should I do?
nicegres will be rebuilt every 24h. If it is mandatory to update it beforehand, build the image yourself or tell me to manually trigger it.