Content-Length: 222821 | pFad | http://github.com/oyuksektepeli/AzureChamp/commit/8da499de778b9cd60c01409fcb39e6cb9fcd28ff

22 commands edited · oyuksektepeli/AzureChamp@8da499d · GitHub
Skip to content

Commit

Permalink
commands edited
Browse files Browse the repository at this point in the history
  • Loading branch information
oyuksektepeli committed Jun 22, 2019
1 parent 72575a0 commit 8da499d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions ContainerVolumes.ps1
Original file line number Diff line number Diff line change
@@ -1,19 +1,46 @@
#run container with persistent volume
docker run -d -p 5432:5432 -v postgres-data:/var/lib/postgresql/data --name postgres1 postgres

#connect to container interactive shell
docker exec -it postgres1 sh

#create db in postgres
createdb -U postgres mydb

#connect to db in postgres
psql -U postgres mydb

#create table in db
CREATE TABLE people (id int, name varchar(80));

#instert data to table
INSERT INTO people (id,name) VALUES (2, 'Onur');

#quit from postgre connection
\q

#quit from container
exit

#delete container
docker rm -f postgres1

#list volumes
docker volume ls

#run new container with existing volume
docker run -d -p 5432:5432 -v postgres-data:/var/lib/postgresql/data --name postgres2 postgres

#connect to containers interactive shell
docker exec -it postgres2 sh
#connect to postgres
psql -U postgres mydb
#get data from postgres
SELECT * FROM people;
\q
exit
#delete container
docker rm -f postgres2
#delete volume
docker volume rm postgres-data

0 comments on commit 8da499d

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/oyuksektepeli/AzureChamp/commit/8da499de778b9cd60c01409fcb39e6cb9fcd28ff

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy