PostgreSQL with Docker: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 6: | Line 6: | ||
This article describes how to stand up and operate a Docker-based PostgreSQL instance. The instance will be accessible on the standard PostgreSQL port on the local host and it will be secured by a conventional user and password. Since the password is visible in the terminal used to create the container image, this approach is not really secure, but it is good enough for development purposes. The container-generated data will be stored on an [[Docker_Storage_Concepts#Anonymous_Volume|anonymous]] [[Docker_Storage_Concepts#Local_Volume_Driver|local]] volume. | This article describes how to stand up and operate a Docker-based PostgreSQL instance. The instance will be accessible on the standard PostgreSQL port on the local host and it will be secured by a conventional user and password. Since the password is visible in the terminal used to create the container image, this approach is not really secure, but it is good enough for development purposes. The container-generated data will be stored on an [[Docker_Storage_Concepts#Anonymous_Volume|anonymous]] [[Docker_Storage_Concepts#Local_Volume_Driver|local]] volume. | ||
=Procedure= | =Procedure= |
Revision as of 20:19, 19 October 2018
Internal
Overview
This article describes how to stand up and operate a Docker-based PostgreSQL instance. The instance will be accessible on the standard PostgreSQL port on the local host and it will be secured by a conventional user and password. Since the password is visible in the terminal used to create the container image, this approach is not really secure, but it is good enough for development purposes. The container-generated data will be stored on an anonymous local volume.
Procedure
Create the Container
This is an one-time operation:
docker run -p 5432:5432/tcp -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=<some-password> --name postgres postgres
Start the Container
docker start postgres
Stop the Container
docker stop postgres
Access Container Logs
docker logs -f postgres