# build image
sudo -i #切换到root
cd /home/songfei/Flowor #cd app
source ./.env && docker build -t ${PRODUCT}:${VERSION} -f manifests/Dockerfile ./
# shutdown flowor
COMPOSE_PROJECT_NAME=flowor docker-compose -f dev-docker-compose.yml down
docker volume rm flowor_postgres #删除docker volume
./manage.py loaddata data-20181022-092726.json #重启load数据
COMPOSE_PROJECT_NAME=flowor docker-compose -f dev-docker-compose.yml up -d
导出数据
python3 manage.py dumpdata --exclude=contenttypes --exclude=auth.Permission > xx.json
# import db
docker exec -it flowor-app bash
python3 ./manage.py loaddata data-20181016-063626.json
关闭方式1:(会删除env,重启重新生成)
# boot env
docker-compose -f dev-docker-compose.yml up -d
# stop
docker-compose -f dev-docker-compose.yml down
关闭方式2:(不会删除env)
# restart docker flowor-app
sudo -i
cd /home/songfei/Flowor
docker-compose -f dev-docker-compose.yml stop #stop
docker-compose -f dev-docker-compose.yml start #start
从upstream 拉下最新代码后,需要进行migrate
docker exec -it flowor-app bash
./manage.py migrate
exit
./manage.py makemigrations
初始化数据
./manage.py flush
进入数据库
psql -U postgres -h postgres
输入密码xx
重启docker,不重新build
docker stop flowor-app
docker start flowor-app
docker restart flowor-app
#停止docker
docker-compose -f dev-docker-compose.yml down
#清理数据,可选
docker volume ls
docker volume rm flowor_postgres
#查看docker images
docker images
#删除相应image
docker rmi flowor:v0.3
sudo -i
cd /home/songfei/Flowor
#启动docker
docker-compose -p flowor -f dev-docker-compose.yml up -d
以前两种情景需要rebuild image,其他情景不需要
情景1:requirements.txt add / delete , rebuild image
情景2:manifests/Dockerfile