How to Set Up a PostgreSQL Database with Docker

Docker is a product that allows developers to create containers, which are self-contained areas on their computer for running applications. They can be used for databases, which is great if you can’t install it normally (e.g. you use a Mac). This video shows you how to set up a PostgreSQL database on Docker. It uses an existing PostgreSQL image on the Docker Hub website. You can use many different versions of PostgreSQL, not just the latest version. You’ll learn how to download and install Docker, find the right PostgreSQL image, download the image, run it, and connect to it in the DBeaver IDE. You can use any other IDE that works with PostgreSQL if you prefer. The connection details for this image mentioned in the video are below. Host: localhost Port: 5432 Username: postgres Password: whatever you specify in the “docker run“ command (default is mysecretpassword) Timestamps: 00:00 In this video 00:05 High-level steps 00:29 Download Docker 01:23 Run Docker 02:07 Create Docker Hub account 02:41 Search for PostgreSQL image on Docker Hub 03:15 Understand the docker run command 04:29 Adjust docker run command 05:19 Open Terminal and login to Docker 06:12 Download image using Docker Run 06:52 Check status using docker ps 07:19 Connect using DBeaver 07:47 Enter connection details 08:43 Run simple query 09:05 Docker Stop command /// RESOURCES Get my free SQL Cheat Sheets for Oracle, SQL Server, MySQL, and Postgres here: SQL Roadmap: an overview of SQL topics, which is a great place to start: Contact me here for questions, sponsorship requests, and more: Want to take your database and SQL skills to the next level? Sign up for Database Star Academy, the online platform for database development and SQL. Check it out here:
Back to Top