How to add postgresql to docker container/containerize postgresql

Published: 25 November 2021
on channel: Programming Tutorial
85
like

#dockerizepostgresql #runpostgresqlinsidedocker #installpostgresqlinsidedocker #installpostgresqlinsidecontainer
How to add postgresql to docker container(Containerize postgresql)

Prerequisite
make sure your machine has installed docker
make sure you have internet connection
make sure your docker running, check if your docker running(linux : sudo systemctl status docker
windows : docker --version if docker is installed while run this command you should get response/ no response error)


Add postgresql to docker container and open postgresql with database client like(dbeaver or other)
1. add postgresql image to local registry
run this command = docker pull postgres:11.14 this command will add postgresql image to local registry with postgresql version 11.14
if you want to add postgresql latest version run this command docker pull postgres(you have 2 docker image in local registry latest version and 11.14. version)
2. create container and install postgresql to container, with set username and password postgresql in first time
if you add docker image to local registry with spesific version (11.14) run this = docker run --name containername -e POSTGRES_PASSWORD=mysecretpassword -d postgres:11.14
if you want to add postgresql image with latest postgressql version run this command = docker run --name postgresql_docker -e POSTGRES_PASSWORD=mysecretpassword -d postgres
3. check postgresql container with this command = docker ps -a
4. check docker container ip address
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' postgresql_docker
5. check if postgresql installed on container(open using db client like dbeaver)


Success, see you at the next tutorial !!!


Watch video How to add postgresql to docker container/containerize postgresql online without registration, duration hours minute second in high quality. This video was added by user Programming Tutorial 25 November 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 85 once and liked it like people.