setting up docker with postgresql on mac

To see more details on installing and configuration of docker and dbeaver and portainer, see this post:
https://sqlkitty.home.blog/2019/12/15/setting-up-docker-with-sql-server-backup-on-mac/

Create a docker volume to have persistent data
docker volume create pgdata

Create posgresql instance (note we are changing the port to 54320 in case 5432 is already in use on your computer:
docker run –name postgres -e POSTGRES_PASSWORD=Putstrongpassw0rdhere! -d -p 54320:5432 -v pgdata:/var/lib/postgresql/data postgres:11

See what containers you have and what is and isn’t running. You should see postgresql listed and running:
docker ps -a

You could also go into Portainer to see the status of your postgresql container if you have Portainer setup

Setup postgresql in dbeaver like below:

Connect to postgresql db in dbeaver and create a new db

create database testdatabase

I want copy data from sql server to postgresql, so I selected all the tables in dbeaver and right-click and say export data

Also, select all the tables and say generate DDL for all the tables

then export as insert sql files and save locally

then run the DDL and insert sql files in postgresql instance in dbeaver

I had to fix the issues in the DDL script since it was scripted from SQL Server so there are keyword and data types and characters not allowed when running postgresql

Search for specific file in docker container
docker export postgres | tar tf – | grep dump

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.