The data volume to use for the database data and log files. Here we use an environment variable named “POSTGRES_PASSWORD” which allows us to set our own password “mypassw1” as the superuser (“postgres”) password for PostgreSQL Here we map the default 5432 Postgres port to the 5462 port of our local host. The port mapping of the host port to the container port. It runs the container detached – in the background and prints the container ID ![]() Here we use the container name: “postgres145” The name of the container (default: auto-generated). The parameters used here are given to the following table: –name: in our case, this is about version 14.5 Check that the image has been created in your local Docker repository docker images Create a working PostgresSQL container $ docker run -d -name postgres145 -p 5462:5432 -e POSTGRES_PASSWORD=mypassw1 -e PGDATA=/var/lib/postgresql/data/pgdata -v $HOME/DOCKER/dockerPostgresDB/datafiles145:/var/lib/postgresql/data postgres ? Note: When you pull an image without specifying a tag name, Docker will try to pull the image tagged latest. Find the official PostgresSQL docker images at DockerHub here.Īs you can also see at the official PostgresSQL site, the latest non-beta version, is the 14.5 version (as it was when I was writing this post on Sep.29, 2022): Pull the image docker pull postgres You have to be familiar with Docker, Docker Images, and Containers, and Docker should be installed in your system (preferably a Linux system or a macOS)īefore pulling the image, it is worth taking a look at the DockerHub. ![]() ![]() Here I want just to show how easy and fast you can set up a Docker working environment for your PostgresSQL development needs, following the latest official PostgresSQL repos at DockerHub. PostgreSQL ranks as the 1st choice of professional developers according to the Stackoverflow Developer Survey 2022.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |