参考:
https://www.cnblogs.com/fengzhihai/p/10078661.html
postgres简易教程:http://www.ruanyifeng.com/blog/2013/12/getting_started_with_postgresql.html
资源:
镜像地址:https://hub.docker.com/r/library/postgres/
CMDBuild开源镜像:https://hub.docker.com/r/quentinv/cmdbuild/
提前安装docker以及docker-compose
确认版本
docker-compose -version
docker-compose version 1.24.1, build 4667896
docker -v
Docker version 19.03.1, build 74b1e89
安装java
yum list java*
yum install java-1.8.0-openjdk.x86_64
获取镜像:
修改repository
vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://hub.docker.com"]
}
~
systemctl restart docker
创建docker container
docker pull postgres:9.3
docker pull quentinv/cmdbuild:latest
docker create --name cmdbuild_postgres -p 5432:5432 postgres:9.3
docker create --name cmdbuild -p 8080:8080 quentinv/cmdbuild:latest
创建docker-compose配置文件
cd /opt
mkdir cmdbuild
cd cmdbuild
vi docker-compose.yml
version : '2'
services:
tomcat:
image: quentinv/cmdbuild:latest
ports:
- 8080:8080
restart: always
networks:
- cmdbuild-network
pgsql:
image: postgres:9.3
restart: always
environment:
- POSTGRES_PASSWORD=postgres
networks:
- cmdbuild-network
networks:
cmdbuild-network:
driver: bridge
启动docker-compose(需要在docker-compose.yml所在路径)
docker-compose up -d
Creating network "cmdbuild_cmdbuild-network" with driver "bridge"
Creating cmdbuild_tomcat_1 ... done
Creating cmdbuild_pgsql_1 ... done
查看状态
docker-compose ps
Name Command State Ports
----------------------------------------------------------------------------------
cmdbuild_pgsql_1 docker-entrypoint.sh postgres Up 5432/tcp
cmdbuild_tomcat_1 catalina.sh run Up 0.0.0.0:8080->8080/tcp
--docker登录psql
docker exec -it cmdbuild_pgsql_1 psql -U postgres -d postgres
修改密码:
ALTER USER postgres WITH PASSWORD 'postgres';
访问地址:
192.168.3.5:8080
数据库名称设为cmdbuild
使用IE登录,chrome有问题
停止命令:
docker-compose down
删除命令:
docker-compose rm
重启命令:
docker-compose restart
查看状态:
docker-compose ps
--优点:
部署较简单
功能比较明确
界面简单
--缺点
缺少中文支持
文档较少