Database containers for local development
📖 Scenario: You are a developer who wants to run a database locally using Docker. This helps you test your applications without installing the database directly on your computer.
🎯 Goal: You will create a Docker command to run a PostgreSQL database container locally with a set username, password, and database name. Then, you will check if the container is running.
📋 What You'll Learn
Use the official PostgreSQL Docker image version 15
Set environment variables for POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DB
Map the container port 5432 to the host port 5432
Name the container 'local-postgres'
Verify the container is running using a Docker command
💡 Why This Matters
🌍 Real World
Developers often use database containers locally to avoid installing databases directly on their machines. This makes setup faster and keeps the system clean.
💼 Career
Knowing how to run and manage database containers is essential for developers and DevOps engineers to create consistent development environments and simplify testing.
Progress0 / 4 steps