- Execute
sudo docker run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=CHANGEME -d postgres
-
Execute
psql -h localhost -U postgres
-
Within the psql shell execute the following lines
CREATE USER barbican WITH PASSWORD 'ALLTHEPASS';
CREATE DATABASE barbican_api;
GRANT ALL PRIVILEGES ON DATABASE barbican_api to barbican;
\q
- Change DB value in /etc/barbican/barbican_api.conf:
sql_connection = postgresql+psycopg2://barbican:ALLTHEPASS@localhost:5432/barbican_api
-
Run in another terminal
sudo docker exec -it postgres /bin/bash
-
Within the docker container, execute
printf "\nhost all all 0.0.0.0/0 trust" >> /var/lib/postgresql/data/pg_hba.conf
- Restart docker container
sudo docker restart postgres