xxxxxxxxxx
# Assuming you have a running PostgreSQL container in Docker
# Step 1: Find the container ID or name
docker ps
# Step 2: Run pg_dump inside the container to create a backup. Replace <CONTAINER_ID/NAME> and <DB_NAME> with the actual values.
docker exec -it <CONTAINER_ID/NAME> pg_dump -U postgres -d <DB_NAME> > backup.sql
# This will create a backup of the specified database named 'backup.sql' in the current directory.