Skip to content

kmjenniferng/postgreSQL-docker-windows

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Set up PostgreSQL database using Docker on Windows

The purpose of this project is to set up PostgreSQL database using Docker on Windows.

  1. Install Docker Destop on Windows
  2. Create a container named PostgresData based on the Alpine image
docker create -v /var/lib/postgresql/data --name PostgresData alpine
  1. Create a container named postgres-spring using PostgresData container with postgres:alpine image
docker run -p 5432:5432 --name postgres-spring -e POSTGRES_PASSWORD=password -d --volumes-from PostgresData postgres:alpine 

  1. Execute the container named postgres-spring in Bash mode
docker exec -it 6a2a91bbaa94 bin/bash
  1. Login to PostgreSQL database
psql -U postgres
  1. Create database named springbootdemodb
CREATE DATABASE springbootdemodb;
  1. Show the list of databases
\l
  1. Connect to database named springbootdemodb
\c springbootdemodb

About

Set up PostgreSQL database using Docker on Windows

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors