Skip to content

volkb/docker-postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simple Postgres Automation Using Docker

Simple automation for postgresql running in Docker using docker-compose

Note: This guide will allow you to containerize Postgres; however, you must go into docker's settings and assure proper # cores and memory is allocated as large queries will take a very long time otherwise

  1. Ensure that docker is installed on your system. If you are a Windows user, and using Docker desktop, recent versions enforce the use of a WSL based engine. To set that up follow the MS guide here. If you are a Windows home user, make sure to use the WSL 2 instructions.

  2. Create a database.env file on the root of the project at the same level as the docker-compose.yml and define the following, ensure that the passwords you set follow compliant password requirements. Note: Postgres does not enforce strong passwords, but it is recommended to follow the strong rules that SQL Server uses found here:

        POSTGRES_USER=[USERNAME]
        POSTGRES_PASSWORD=[COMPLIANT PASSWORD]
        POSTGRES_DB=[DEFAULT DB NAME]
    
  3. Open a terminal (for windows use Powershell), and cd into the directory of the docker-compose file

  4. Run docker-compose up --build and wait for the terminal to read "Ready to Accept Connections"

  5. open any Database GUI that has a valid postgres connection driver (This guide assumes the use of Datagrip):

    Host: Localhost
    Port: 5432
    User: user defined in .env file
    Password: password defined in .env file
    Database: postgres
    
  6. When you are finished working, simply open a terminal (for windows use Powershell) and run docker-compose down or press Ctrl+C to stop the container if you are not running in detached mode this will turn off the server, freeing system resources and re-openeing port 5432

About

Simple automation for postgresql running in Docker using docker-compose

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages