diff --git a/README.md b/README.md index 41cc4471..e2774e14 100644 --- a/README.md +++ b/README.md @@ -67,21 +67,21 @@ __Make sure you already installed [docker](https://www.docker.com)__ __If you already had a backup file `cards.db`. Run following command:__ *Note: We don't need to rebuild image, just delete old container if you already built.* -`docker run -d -p 8000:8000 --name cs-flash-cards -v ::/src/db cs-flash-cards` -``: is the full path contains `cards.db` +`docker run -d -p 8000:8000 --name cs-flash-cards -v ::/src/db cs-flash-cards`. +``: is the full path contains `cards.db`. Example: `/home/tinpee/cs-flash-cards/db`, and `cards.db` is inside this folder. -For convenient, if you don't have `cards.db`, this container will auto copy a new one from `cards-jwasham.db`. So you don't need to `initdb` +For convenient, if you don't have `cards.db`, this container will auto copy a new one from `cards-jwasham.db`. So you don't need to `initdb`. -__How to backup data ?__ +### How to backup data ? We just need store `cards.db` file, and don't need any sql command. - If you run container with `-v :/src/db` just go to `folder_db` and store `cards.db` anywhere you want. - Without `-v flag`. Type: `docker cp :/src/db/cards.db /path/to/save` -__How to restore data ?__ +### How to restore data ? - Delete old container (not image): `docker rm cs-flash-cards` - Build a new one with `-v flag`: -`docker run -d -p 8000:8000 --name cs-flash-cards -v ::/src/db cs-flash-cards` +`docker run -d -p 8000:8000 --name cs-flash-cards -v :/src/db cs-flash-cards` - Voila :) *Happy learning!* diff --git a/db/.gitkeep b/db/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/entrypoint.sh b/entrypoint.sh index 6376c182..82bb0d40 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,7 +1,6 @@ #!/bin/bash if [ ! -f /src/db/cards.db ]; then - mkdir -p /src/db cp cards-jwasham.db /src/db/cards.db fi