This Docker repo contains a bunch of Postgres related packages. View the Dockerfile for a complete list of what is installed.
If you are running Docker and have the resources to host these on your laptop / pc feel free to set it up following the instructions below.
git clone git@github.com:jtorral/pgTraining.git
docker build -t pg16-rocky8-bundle .
docker build -t pg16-rocky8-bundle .
docker build -t pg16-rocky8-bundle .
docker network create pgnet
If you want the containers to start postgres automatically, add the following environment variable to each of the docker run commands below
--env=PGSTART=1
docker run -p 5411:5432 --env=PGPASSWORD=postgres -v pg1-pgdata:/pgdata --hostname pg1 --network=pgnet --name=pg1 -dt pg16-rocky8-bundle
docker run -p 5412:5432 --env=PGPASSWORD=postgres -v pg2-pgdata:/pgdata --hostname pg2 --network=pgnet --name=pg2 -dt pg16-rocky8-bundle
docker run -p 5413:5432 --env=PGPASSWORD=postgres -v pg3-pgdata:/pgdata --hostname pg3 --network=pgnet --name=pg3 -dt pg16-rocky8-bundle
docker run -p 5415:5432 --env=PGPASSWORD=postgres -v pgbackrest-pgdata:/pgdata --hostname pgbackrest --network=pgnet --name=pgbackrest -dt pg16-rocky8-bundle
We will run the ETCD services on the same container as the database server. If, we wanted them on separate conatiners we would run them like so
docker run --hostname etcd1 --network=pgnet --name=etcd1 -dt pg16-rocky8-bundle
docker run --hostname etcd2 --network=pgnet --name=etcd2 -dt pg16-rocky8-bundle
docker run --hostname etcd3 --network=pgnet --name=etcd3 -dt pg16-rocky8-bundle
If you wish to cleanup the docker containers afterwards you will need to stop them and remove them. You can leave the volumes in place if you want the data saved or you can remove them as well. It is all detailed below
For example, if we are running just the 1 container pg1 and want to remove it ...
docker stop pg1
docker rm pg1
Then identify the volumes used by it
docker volume ls
DRIVER | VOLUME NAME |
---|---|
local | pg1-pgdata |
local | pgDipper-etc |
local | pgDipper-home |
local | pgDipper-pgdata |
Remove the volume if you want it gone for good.
docker volume rm pg1-data
There may be additional volumes if you started the other containers
Finally, if you want to remove the network created earlier then run ...
docker network rm pgnet
If you find this repo useful, feel free to send me a dozen classic glazed doughnuts from Krispy Kreme.