Solution to Challenge: Running a Postgres Database
Understand how to run a PostgreSQL database container with Docker by using run commands that include interactive mode, port publishing, volume mounting, and environment variable setup. This lesson helps you manage persistent data and connect securely to your Postgres instance inside Docker.
We'll cover the following...
We'll cover the following...
Solution
The following command will run the PostgreSQL:
docker run \
-it --rm --name postgres \
-p 3000:5432 \
--mount "src=postgresdata,target=/var/lib/postgresql/data" ...