Start postgres mac

broken image
broken image

uses the -d flag to run in the background.exposes port 54320 to the host using -p.uses a named volume, my_dbdata, to store postgres data.uses the official docker postgres 13 image.Install Docker ¶Īlternatively, you can install Docker using Homebrew: brew install homebrew/cask/docker OPTION 1: Run Postgres using a single Docker command ¶ Run a postgres container I also wrote some notes on Postgres and Homebrew here. Currently I use the Homebrew Postgres for work, and Postgres in Docker for personal projects. We use Docker extensively at work, so from a mental overhead point of view, it's something I wanted to learn anyways. Admittedly, I didn't know Homebrew well, but it was frustrating.) Disadvantages of Docker are it's another layer of abstraction to learn and interact with. (I previously had a problem where Homebrew upgraded Postgres when I didn't expect it to and my existing database became incompatible. Running in Docker allows keeping my database environment isolated from the rest of my system and allows running multiple versions and instances.

broken image

These are my notes for running Postgres in a Docker container for use with a local Django or Rails development server running on the host machine (not in Docker). Date: | Modified: | Tags: docker, linux, mac, sql

broken image