Skip to content

Instantly share code, notes, and snippets.

@stanlee321
Last active August 17, 2020 00:07
Show Gist options
  • Save stanlee321/802715cf2666d080cd3465ea3df26c4b to your computer and use it in GitHub Desktop.
Save stanlee321/802715cf2666d080cd3465ea3df26c4b to your computer and use it in GitHub Desktop.
Install postgress

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-18-04

Use these following commands, this will solve the error:

sudo apt-get install postgresql then fire:

sudo apt-get install python-psycopg2 and last:

sudo apt-get install libpq-dev

pip install psycopg2

pgadmin

https://www.pgadmin.org/download/pgadmin-4-apt/

docker comands

docker-compose logs -f

docker-compose up --build -d --remove-orphans

Get into

docker exec -ti efd8 psql -U postgres

postgres create user

https://stackoverflow.com/questions/16973018/createuser-could-not-connect-to-database-postgres-fatal-role-tom-does-not-e

create volumen

docker volume create --name=postgres-v12

Base image

version: '3.1'

services:

    postgres:
        image: postgres:12
        container_name: "postgres-v12"
        ports:
            - 5432:5432
        environment:
            POSTGRES_PASSWORD: admin
        volumes:
            - db_vol:/var/lib/postgresql/data

    pgadmin:
        image: dpage/pgadmin4
        container_name: pgadmin4
        ports:
            - 3333:80
        environment:
            PGADMIN_DEFAULT_EMAIL: admin
            PGADMIN_DEFAULT_PASSWORD: admin


volumes:
    db_vol:
        external:
            name: "postgres-v12"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment