Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
varbanandreev authored May 11, 2020
1 parent c07fcd7 commit 2a265f5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Tasks/5.Using volumes/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Practice - using volumes

Run a container "mypsql" using **postgres:12** with options to:
- run the container in detached mode
- pass an environment variable `POSTGRES_PASSWORD=secretpass`
- create a named volume with `-v <name>:/var/lib/postgresql/data`
Run a container **mypsql** using **postgres:12** with options to:
- run in detached mode
- pass the appropriate environment variable (find it on https://hub.docker.com/)
- use a named volume

Run a shell in the container and use psql to add a table and a record:
Run bash in the container and use psql to add a table and a record:
- $ `psql -U postgres`
- $ `create table public.films (id int PRIMARY KEY, name varchar(255));`
- $ `insert into films(id, name) values(1, 'Some movie');`

Exit the container and delete it. Run a new container with the same options. Use ***the same*** volume name to re-use the existing volume.
Exit the container and delete it. Run a new container with the same options (use ***the same*** volume name).

Run a shell inside the container and see if your data is still there:
Run bash inside the new container and see if your data has survived:
- $ `psql –U postgres`
- $ `select * from public.films;`

0 comments on commit 2a265f5

Please sign in to comment.