pg_dump -h localhost -U username dbname > /data/x.sql

ALTER USER postgres WITH PASSWORD 'passwd';

pg_dump -U postgres -t username dbname > ./test.sql

pg_dump -h localhost -U postgres dbname > demo.sql

iptables -L -n

sudo curl -L https://github.com/docker/compose/releases/download/1.28.6/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose


CREATE USER wiki WITH PASSWORD 'passwd';
CREATE DATABASE dbname OWNER username;
GRANT ALL PRIVILEGES ON DATABASE dbname to username;

docker run -d -p 80:3000 --name anyname --restart unless-stopped -e "DB_TYPE=postgres" -e "DB_HOST=db" -e "DB_PORT=5432" -e "DB_USER=username" -e "DB_PASS=passwd" -e "DB_NAME=dbname" requarks/wiki:2

docker run --name mypostgres -d -p 5432:5432 -e POSTGRES_PASSWORD="passwd" postgres
docker exec -it mypostgres psql -U postgres -d postgres
psql -d dbname -U username -f gg.sql

sudo docker exec -it ID /bin/bash

iptables -I INPUT -p tcp --dport 3000 -j ACCEPT

# 1.下载新的包
docker-compose pull wiki
# 2. 重新创建
docker-compose up --force-recreate -d

上面都没啥用,发现个更简单的,将数据库先运行导入数据后再启动第二个容器,完美兼容

Last modification:April 14th, 2021 at 04:07 am