[DevOps] Set up and run a PostgreSQL instance locally with Docker Compose
Posted Answer1215
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[DevOps] Set up and run a PostgreSQL instance locally with Docker Compose相关的知识,希望对你有一定的参考价值。
When we need to spin up a database instance for our new project, installing the database management system directly on our local machine is almost always a bad idea. Luckily, Docker is here to help us practically reduce the complexity of dealing with "missing dependencies" and weird error messages down to zero.
In this lesson, we will learn how to get a PostgreSQL instance running locally with Docker Compose, so we can work on the database integration of our project and test things out with ease. To follow this lesson, you will need to have Docker pre-installed.
docker-compose.yml:
version: "3.8" services: db: image: "postgres:12" ports: - "54320:5432" volumes: - ./pgdata:/var/lib/postgresql/data environment: - POSTGRES_USER=alice - POSTGRES_PASSWORD=wonderland - POSTGRES_DB=myawesomedb
# Up and Running docker-compose -d # Check Whether contain is running docker-compose ps # enter the shell docker-compose run db bash ## Verify db exist poql --host=db --username=alice --dbname=myawesomedb ## Esc the db Ctrl + d twice # Off docker-compose down
以上是关于[DevOps] Set up and run a PostgreSQL instance locally with Docker Compose的主要内容,如果未能解决你的问题,请参考以下文章
Setting up Storm and Running Your First Topology
[Vue] Get up and running with vue-router
[译]How-to set up a redundant storage pool with ZFS and Ubuntu
Set up and Use Local Yum Repository
Using MEF to Set Up Dependency Injection
sql http://mono.software/2017/07/13/missing-incorrectly-set-up-and-unused-indexes-and-their-impact-o