Giter Site home page Giter Site logo

shamimgeek / docker-compose-postgres Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 781 KB

Postgresql with pgadmin4 and docker-compose and practice sql

License: Apache License 2.0

TSQL 100.00%
postgresql pgadmin4 docker docker-compose pgadmin-docker sql

docker-compose-postgres's Introduction

docker-compose-postgres-pgadmin4

Requirements:

  • docker
  • docker-compose

Quick Start

  • Clone this repository
  • Go to directory, cd docker-compose-postgres
  • Run this command docker-compose -f docker-compose-postgres-pgadmin4.yml up -d

Environment Variables

  • POSTGRES_USER the default value is postgres
  • POSTGRES_PASSWORD the default value is passw0rd
  • PGADMIN_PORT the default value is 8080
  • PGADMIN_DEFAULT_EMAIL the default value is [email protected]
  • PGADMIN_DEFAULT_PASSWORD the default value is passw0rd

Access to postgres:

  • localhost:5432
  • Username: postgres (as a default)
  • Password: passw0rd (as a default)

Access to postgres using terminal:

docker exec -it postgres psql -U postgres

for more postgresql commands check here

Access to PgAdmin:

  • URL: http://localhost:8080
  • Username: [email protected] (as a default)
  • Password: passw0rd (as a default) pgadmin_login_page

Add a new server in PgAdmin:

  • Host name/address postgres
  • Port 5432
  • Username as POSTGRES_USER, by default: postgres
  • Password as POSTGRES_PASSWORD, by default passw0rd add_server_to_pgadmin1 add_server_to_pgadmin2 add_server_to_pgadmin3

docker-compose-postgres's People

Contributors

shamimgeek avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

benh4rdy bendia93

docker-compose-postgres's Issues

Use docker-entrypoint-initdb.d

If we create a Dockerfile

FROM postgres:12.4-alpine
ADD /SQL/*.sql /docker-entrypoint-initdb.d/

and then use it in docker-compose-postgres-pgadmin4.yml:

version: '3.5'

services:
  postgres:
    container_name: postgres
    build: .

...
...

then it will automatically run those sql files for data setup.

What do you think?

If you would like to do additional initialization in an image derived from this one, add one or more *.sql, *.sql.gz, or *.sh scripts under /docker-entrypoint-initdb.d (creating the directory if necessary). After the entrypoint calls initdb to create the default postgres user and database, it will run any *.sql files, run any executable *.sh scripts, and source any non-executable *.sh scripts found in that directory to do further initialization before starting the service.

Warning: scripts in /docker-entrypoint-initdb.d are only run if you start the container with a data directory that is empty; any pre-existing database will be left untouched on container startup. One common problem is that if one of your /docker-entrypoint-initdb.d scripts fails (which will cause the entrypoint script to exit) and your orchestrator restarts the container with the already initialized data directory, it will not continue on with your scripts.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.