- Install
dockeranddocker-compose - cd in to Project dir and Build docker with command
$ docker-compose build
- Runserver
$ docker-compose up -d
Now the API server is running on : http://localhost:8000 API Document server is running on http://localhost:1234
- ALWAYS follow PEP8 coding style http://pep8.org
$ docker exec -it <container-id> python manage.py test
docker ps
docker exec -t <db container id> pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
- The first
docker-compose down - show docker volume
docker volume ls - remove volume sql exist with command :
docker volume rm <name volume> - create docker db volume blank with command:
docker-compose up -d dbdocker-compose up -d <db_name_serivice> - import sql file with command:
cat <sqlfile.sql> | docker exec -i <dontainer id> psql -U <username> -d <dbname> - for example:
cat app-db-2018-11-16.sql | docker exec -i e1a2a1e3ab89 psql -U postgres -d postgres
Duc Tran, Son Nguyen