Postgresql
Postgresql is a very popular opensource relational database.
Installation
Installing PGAdmin4 through APT
package manager is a good way to get Postgresql set up on a Ubuntu based distro, here's the latest instructions.
PGAdmin4 Intallation Instructions
Creating a database using docker
Docker is a fun way to run a database, and a good way to learn about Docker Volumes. Here's a simple way to start.
Create a folder structure like so...
/db
Dockerfile
/scripts
database-definition.sql
Dockerfile
FROM postgres:alpine
COPY scripts/ /docker-entrypoint-initdb.d
SQL
CREATE SCHEMA postgres AUTHORIZATION postgres;
CREATE SEQUENCE kidseq START 1;
CREATE TABLE postgres.kid (
kid_id numeric NOT NULL DEFAULT nextval('kidseq') PRIMARY KEY,
kid_name text,
balance money
);
Build your image
docker build -t mydatabase .
Run it
docker run --rm -it -p 5432:5432 -e POSTGRES_PASSWORD=<DatabasePassword> mydatabase
Connect with PGAdmin4
Last update: September 30, 2020