freetriple.blogg.se

Docker for mac postgres
Docker for mac postgres









  1. #DOCKER FOR MAC POSTGRES SOFTWARE#
  2. #DOCKER FOR MAC POSTGRES PASSWORD#

  • postgres:latest → use the latest image from the official postgres registry.
  • This is helpful to connect to the database from your backend
  • -p 5432:5432 → map the port 5432 (default for Postgres) from the container to map 5432 on your computer (localhost).
  • #DOCKER FOR MAC POSTGRES PASSWORD#

    -e POSTGRES_PASSWORD=postgres → same as before, but for the password.-e POSTGRES_USER=postgres → set up the container using postgres as the main user for the DB.This is necessary so that our tables are not wiped every time we restart the container -v postgres_data:/var/lib/postgresql/data → create a persistent volume ( postgres_data) that holds the information from /var/lib/postgresql/data on the container.docker run -d -name postgres13 → run a new container in detached mode (-d) with the name of postgres13.Here's a detailed explanation of the instructions that the command is executing: To run a new Docker container on the latest Postgres image, simply open your terminal and run: docker run -d -name postgres13 \ -v postgres_data:/var/lib/postgresql/data \ -e POSTGRES_USER=postgres \ -e POSTGRES_PASSWORD=postgres \ -p 5432:5432 \ postgres:latest I personally find the approached described in this paragraph much cleaner. Alternatively, you can look into installing PostgreSQL via brew. That's certainly true for my production servers, but I also like to apply such a practice on my daily duties. I like my databases to run on isolated instances, so I don't send my heart racing every time I perform a migration 🐎. Sometimes we use Django, but that's for another day. Installing our database of choice: PostgreSQLĪt Signofactory, our stack of choice (as of Jan 2021) is composed of React.js, Node.js (with Express.js), TypeScript and PostgreSQL. There are some known limitations, but I honestly have found it suitable for my daily use-as a disclaimer, I offload image building and uploading to registries to CI / CD pipelines on GitHub Actions, so I mainly use Docker to run some local images.Ģ. If you are on Apple silicon - like I am - you can use the M1 preview build from the official Docker website. I honestly have no reason not to recommend it.

    docker for mac postgres

    But Docker Desktop comes with CLI tools out-of-the-box as well as support for stuff like Docker Compose (which you'll face eventually in your life as a full-stack developer).

    docker for mac postgres

    I know, I know, we all hate GUIs and we all prefer CLI tools 🙄.

    docker for mac postgres

    Installing Docker on your Mac is extremely easy, thanks to Docker Desktop. And you can have multiple versions of an image on your Mac to develop across many different projects! You don't have to bother about setting up separate environments or making sure that the version of Postgres you have installed on your local machine is the same that's running on the server - you simply need to make sure that the image on your server and the one on your machine are compatible. What I love about using Docker is its flexibility in handling local development environments.

    docker for mac postgres

    #DOCKER FOR MAC POSTGRES SOFTWARE#

    Just see it as an alternative way to installing and managing some software on your machine. For the purposes of this tutorial, you don't have to be a containers or Kubernetes guru. If you are not familiar with Docker, I highly recommend you have a look at the awesome "Docker in 100 seconds" video from Fireship. The latter also has a native Mac app, but I prefer to run it this way. We are going to run images for our database of choice ( PostgreSQL) and for our database tool of choice, pgAdmin. It will allow us to manage containers that we will use to greatly smooth our local development experience.











    Docker for mac postgres