运行
docker run -d -p 8080:80 \
-m 2g
-e OPENPROJECT_SECRET_KEY_BASE=secret \
-e OPENPROJECT_HOST__NAME=localhost:8080 \
-e OPENPROJECT_HTTPS=false \
openproject/community:12
docker 导出
docker exec -it $OP_CONTAINER_NAME su - postgres -c 'pg_dump -d openproject -x -O' > openproject.sql
另一电脑运行openproject
docker run -d -p 8080:80 \
-e OPENPROJECT_SECRET_KEY_BASE=secret \
-e OPENPROJECT_HOST__NAME=localhost:8080 \
-e OPENPROJECT_HTTPS=false \
openproject/community:12
假设新容器为: 907644831c29
恢复
docker cp openproject.sql 907644831c29:/app
docker exec -it 907644831c29 /bin/bash
openproject stop
su postgres
psql -U postgres
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE datname='openproject' AND pid <> pg_backend_pid();
DROP DATABASE openproject;
CREATE DATABASE openproject OWNER openproject;
\c openproject
\i openproject.sql