Skip the Docker installation steps 1. Pull the postgresql image docker pull postgresql 2. Create a local volume. The data volume can be shared and reused between containers. By default, it will always exist even if the container is deleted ( docker volume create pgdata 3. Start the container docker run --name postgres2 -e POSTGRES_PASSWORD=password -p 5432:5432 -v pgdata:/var/lib/postgresql/data -d postgres 4. Enter the postgres container and execute SQL docker exec -it postgres2 bash psql -h localhost -p 5432 -U postgres --password At this point, postgresql is installed successfully. Supplement: Let's see how to install postgresql in docker Pull the image Start the container Create the docker run --name postgres -e POSTGRES_PASSWORD=password -p 5432:5432 -v /usr/postgresql/data:/var/lib/postgresql/data -d postgres Enter postgresql # Enter the container docker exec -it postgres /bin/bash # Enter the folder cd /usr/lib/postgresql/9.6/bin # Enter postgresql, the default postgres user psql -Upostgres This is the end of this article about the steps to install and persist the postgresql database in docker. For more information about installing the postgresql database in docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of the basic usage of VUE watch listener
Special symbols Named Entities Decimal encoding S...
For record, it may be used in the future, and fri...
Table of contents 1. Page Rendering 2. Switch tag...
Learning Linux commands is the biggest obstacle f...
Table of contents 1. typeof 2. instanceof 3. Diff...
Although Microsoft has done a lot of research and ...
Table of contents Preface 1. Check the file disk ...
This article uses examples to illustrate the prin...
1. What is a virtual host? Virtual hosts use spec...
Purpose: Treat Station A as the secondary directo...
This article example shares the specific code of ...
HTML is the abbreviation of Hypertext Markup Langu...
Use stored procedures to start transactions when ...
This article example shares the specific code of ...
Windows Server 2012 and Windows Server 2008 diffe...