introduceThe project recently upgraded the Posgres database from 9.6 to 12+. In order to do some migration tests, I need to install several versions of Postgres locally. The most convenient way is to install it using Docker. There is no version conflict problem, and it is easy to manage and delete. It is also recommended to use docker-compose or stack. Simply put, the data can be stored locally, so that the data will not be lost each time it is restarted and can be reused. If you are doing integration testing, you can start a new DB each time. The following docker-compose file also contains pgAdmin, which makes it easier to use Postgres. You can also use your favorite DB browser. I use the Database plugin that comes with IDEA (ultimate). Support Intel CPUI used it for a while under MacOS and it was fine.
illustrate:
version: '3.5' services: postgres: container_name: pg12 image: postgres:12 environment: POSTGRES_USER: pg12 POSTGRES_PASSWORD: pg12 PGDATA: /data/postgres volumes: - postgres12:/Users/szhang/postgresql/pg12 ports: - "5432:5432" networks: - pg12 restart: unless-stopped pgadmin: container_name: pgadmin12 image: dpage/pgadmin4 environment: PGADMIN_DEFAULT_EMAIL: [email protected] PGADMIN_DEFAULT_PASSWORD: [email protected] volumes: - pgadmin12:/Users/szhang/postgresql/.pgadmin12 ports: - "27777:80" networks: - pg12 restart: unless-stopped networks: pg12: driver: bridge volumes: postgres12: pgadmin12: Support for Apple M1The only difference in this version is that the Postgres image is an ARM version, which specifically supports computers with the latest Apple M1 chip. One more thing, Apple M1 computers can run Docker, but many Docker images do not have ARM versions yet, so it is not convenient to use M1 computers for development (which requires Docker) at present. version: '3.5' services: postgres: container_name: pg12 image: arm64v8/postgres:12.6 environment: POSTGRES_USER: pg12 POSTGRES_PASSWORD: pg12 PGDATA: /data/postgres volumes: - postgres12:/Users/shubozhang/dev/postgresql/pg12 ports: - "5432:5432" networks: - pg12 restart: unless-stopped pgadmin: container_name: pgadmin12 image: dpage/pgadmin4 environment: PGADMIN_DEFAULT_EMAIL: [email protected] PGADMIN_DEFAULT_PASSWORD: [email protected] volumes: - pgadmin12:/Users/shubozhang/dev/postgresql/.pgadmin12 ports: - "27777:80" networks: - pg12 restart: unless-stopped networks: pg12: driver: bridge volumes: postgres12: pgadmin12: testpgAdmin Log in, using the email and password in docker-compose User Interface Intellij IDE Use username, password, and port to connect. This is the end of this article about installing Postgres 12 + pgadmin (supporting Apple M1) with local Docker. For more relevant content about installing Postgres with Docker, please search previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Vue-CLI3.x automatically deploys projects to the server
>>: Detailed explanation of MySQL binlog usage
Problem Description Recently, there was a MySQL5....
Preface Every good habit is a treasure. This arti...
Table of contents Example 1 Example 2 Example 3 E...
Result:Implementation code: html <!-- Please h...
Introduction to Linux top command The top command...
*******************Introduction to HTML language (...
Installation Script Ubuntu / CentOS There seems t...
1, %: represents any 0 or more characters. It can...
Table of contents 1. ChildNodes attribute travers...
To deploy multiple sites on a server, you need to...
Configure the accelerator for the Docker daemon S...
Development Background: Recently, I am working on...
The default operating mode of MySQL is autocommit...
■ Website theme planning Be careful not to make yo...
When an employer asks you whether an index will b...