88
loading...
This website collects cookies to deliver better user experience
$docker
in your console and it would show how to install Docker.$docker volume create postgresqldata
$docker volume ls
command.DRIVER VOLUME NAME
local postgresqldata
$docker run -d -v postgresqldata:/data/db -e POSTGRES_PASSWORD=postgres --name postgres -p 5432:5432 postgres
Status: Downloaded newer image for postgres:latest
$docker ps -a
to see it is saved ok.CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
postgres "docker-entrypoint.s…" 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp postgres
$docker exec -it postgres /bin/bash
to use the console of the Docker image and then $psql -h localhost -U postgres
to use psql commands in your console.\password
later if you want after you complete this post.$docker run --name pgadmin -e "[email protected]" -e "PGADMIN_DEFAULT_PASSWORD=admin" -p 5050:80 -d dpage/pgadmin4
Status: Downloaded newer image for dpage/pgadmin4:latest
$docker ps -a
again. Then, visit http://localhost:5050/login to see it is working ok and login to it with the username and password you used before.$docker network create --driver bridge pgnetwork
$docker network ls
command.NETWORK ID NAME DRIVER SCOPE
pgnetwork bridge local
$docker network connect pgnetwork pgadmin
$docker network connect pgnetwork postgres
docker network inspect pgnetwork
command.[
{
"Name": "pgnetwork",
{
"Name": "pgadmin",
"Name": "postgres",
}
},
}
]
$docker stop pgadmin postgtres
# Intel
# $pip install psycopg2 or
# M1
# $brew install postgresql, $brew link openssl
# export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include -I/opt/homebrew/opt/icu4c/include"
# export PATH=/opt/homebrew/opt/postgresql@13/bin:$PATH
# export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib"
# export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"
# export PKG_CONFIG_PATH="/opt/homebrew/opt/[email protected]/lib/pkgconfig"
# pip install psycopg2-binary