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
sudo configuration file The default configuration...
1. Introduction to yum Yum (full name Yellow dogU...
1|0 Compile the kernel (1) Run the uname -r comma...
This article describes how to use MySQL to export...
<body> <div id="root"> <...
Table of contents The pitfalls Filling method Wha...
Nested use of MySQL ifnull I searched online to s...
The previous article introduced how Vue can reali...
This article example shares the specific code of ...
Table of contents Preface Core - CancelToken Prac...
Rich text editors are often used when doing backg...
Docker-compose deploys gitlab 1. Install Docker I...
Virtual machine software: vmware workstation Imag...
Copy code The code is as follows: @charset "...
When the carriage return character ( Ctrl+M ) mak...