mirror of
https://github.com/marcel-dempers/docker-development-youtube-series.git
synced 2025-06-06 17:01:30 +00:00
postgres wip
This commit is contained in:
parent
b861f2436d
commit
4b429beda4
40
storage/databases/postgres/docker/README.md
Normal file
40
storage/databases/postgres/docker/README.md
Normal file
@ -0,0 +1,40 @@
|
||||
# notes
|
||||
|
||||
# docker image: https://hub.docker.com/_/postgres
|
||||
|
||||
```
|
||||
cd storage\databases\postgres
|
||||
```
|
||||
|
||||
```
|
||||
docker run -it --rm --name postgres-1 `
|
||||
-e PGDATA=/var/lib/postgresql/data/pgdata `
|
||||
-e POSTGRES_DB=postgresdb `
|
||||
-e POSTGRES_USER=postgresadmin `
|
||||
-e POSTGRES_PASSWORD=admin123 `
|
||||
-p 5000:5432 `
|
||||
-v ${PWD}/postgres-1/pgdata/:/var/lib/postgresql/data/pgdata `
|
||||
postgres:14.4
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
# enter the container
|
||||
docker exec -it postgres-1 bash
|
||||
|
||||
# login to postgres
|
||||
psql --username=postgresadmin postgresdb
|
||||
|
||||
#create a table
|
||||
CREATE TABLE guestbook (visitor_email text, vistor_id serial, date timestamp, message text);
|
||||
|
||||
#add record
|
||||
INSERT INTO guestbook (visitor_email, date, message) VALUES ( 'jim@gmail.com', current_date, 'This is a test.');
|
||||
|
||||
#show table
|
||||
\dt
|
||||
|
||||
# quit
|
||||
\q
|
||||
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user