Thu Sep 03 2020
Anurag Kumar
Docker : Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers.
PostgreSQL: PostgreSQL is a free and open-source relational database management system emphasizing extensibility and SQL compliance.
docker run --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -d postgres
docker ps
Now you can see your docker container id like this :
lets go inside docker as a bash shell
docker exec -it <CONTAINER ID> bash
docker exec -it d909cca76479 bash
Lets first, create database
create database newdb;
create user with password
create user newuser with encrypted password 'mynewpassword';
add user to database
grant all privileges on database newdb to newuser;
4. Backup and Restore are same you just need to change " > " direction for backup and " < " for restore.
pg_dump -C -h [Hostname] -d [dbname] -p [port] -U [username] -W > backup.sql
cat backup.sql | docker exec -i <CONTAINER ID> psql -U newuser newdb
That's how simple it is to manage postgres in docker!
SHARE THIS ARTICLE
Thu Mar 10 2016
OAuth authentications are pretty popular now a days and another thing which is popular is JavaScript. This article shows how to plugin google’s oAuth api for authentication in your own node application.Sat Mar 01 2014
This is a continuation of my CSS3 loader snippet collection series. I've provided spinning css3 animation loader in the part 1 of this series and here in part 2, I'm providing various square type loading