Created
April 24, 2025 17:54
-
-
Save BrunoMoreno/2d4e810be8a600aa5c7645908fa04e58 to your computer and use it in GitHub Desktop.
Script to install postgres with podman.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script para subir PostgreSQL com Podman no Fedora Atomic | |
CONTAINER_NAME="postgres" | |
VOLUME_NAME="pgdata" | |
POSTGRES_USER="admin" | |
POSTGRES_PASSWORD="admin123" | |
POSTGRES_DB="meubanco" | |
POSTGRES_PORT="5432" | |
echo "🗃️ Criando volume persistente..." | |
podman volume create $VOLUME_NAME | |
echo "🐘 Subindo container do PostgreSQL..." | |
podman run -d \ | |
--name $CONTAINER_NAME \ | |
-e POSTGRES_USER=$POSTGRES_USER \ | |
-e POSTGRES_PASSWORD=$POSTGRES_PASSWORD \ | |
-e POSTGRES_DB=$POSTGRES_DB \ | |
-v $VOLUME_NAME:/var/lib/postgresql/data:Z \ | |
-p $POSTGRES_PORT:5432 \ | |
docker.io/library/postgres:16 | |
echo "✅ Container '$CONTAINER_NAME' rodando na porta $POSTGRES_PORT" | |
echo "🧪 Conecte com:" | |
echo " psql -h localhost -U $POSTGRES_USER -d $POSTGRES_DB" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment