Here’s how you can connect a local database to Mage in Docker for development.
docker run
instead, as it’s a bit simpler.
PostgreSQL - Docker compose
.env
file with the following variables:POSTGRES_DB
POSTGRES_USER
POSTGRES_PASSWORD
POSTGRES_HOST
PG_HOST_PORT
docker-compose.yml
file:PostgreSQL - Docker run
Create Docker network
Start PostgreSQL Docker container
Launch Mage with `MAGE_DATABASE_CONNECTION_URL`
MSSQL - Docker run
Create Docker network
Start MSSQL Docker container
Launch Mage with `MAGE_DATABASE_CONNECTION_URL`
DRIVER={ODBC Driver 18 for SQL Server}
: a formatted string with a version number matching that of the SQL serverSERVER=database_server
: the name or IP address of the database serverDATABASE=database
: the name of the databaseUID=user
: the user ID for the databasePWD=password
: the password for the userENCRYPT=yes
: whether to use encryptionTrustServerCertificate=yes
: whether to trust the server certificate