Skip to content

YukihiroArakawa/PostgreSqlOnDocker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

PostgreSqlOnDocker

Environment

You need to install Docker Desktop or docker, docker compose.

How to use

  1. open Docker Desktop(or run docker by terminal)

  2. build

$ docker-compose build
  1. start server in background process.
$ docker-compose up -d
  1. check what this container is running.
$ docker-compose ps
NAME                COMMAND                  SERVICE             STATUS              PORTS
sample-db-dev       "docker-entrypoint.s…"   database            running             0.0.0.0:5432->5432/tcp
  1. login to database.
$ docker-compose exec database bash
580677b2bfe0:/# psql -U admin sample
psql (13.10)
Type "help" for help.

sample=#
  1. create database and dive into created db.
sample=# CREATE DATABASE mydb;
CREATE DATABASE

sample=# \c mydb
You are now connected to database "mydb" as user "admin".
  1. create table and enjoy playing PostgreSQL !

  2. If you exit from db and the container, please type \q and exit. Then you can go back to your termial.

mydb=# \q
580677b2bfe0:/# exit
exit

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published