一 放在开头,一直觉得docker是个好东西,基于linux namespace做隔离、cgroup做资源限制、联合文件系统和宿主机的内核作为整套系统,
本课的搭建工作将基于docker-compose进行,docker以及docker-compose的安装配置工作,这里就不作介绍了,不熟悉的可自行百度,google。
二 docker-compose搭建:
镜像地址:https://hub.docker.com/r/library/postgres/
postgres简易教程:http://www.ruanyifeng.com/blog/2013/12/getting_started_with_postgresql.html
CMDBuild开源镜像:https://hub.docker.com/r/quentinv/cmdbuild/
1 docker-compose安装及基本使用:
下载最新版的docker-compose文件
https://github.com/docker/compose/releases(版本选择)
$ sudo curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose $ sudo chmod +x /usr/local/bin/docker-compose docker-compose --version docker-compose version 1.16.1, build 1719ceb
docker-compose和docker兼容性:
compose文件格式版本 docker版本 3.4 17.09.0+ 3.3 17.06.0+ 3.2 17.04.0+ 3.1 1.13.1+ 3.0 1.13.0+ 2.3 17.06.0+ 2.2 1.13.0+ 2.1 1.12.0+ 2.0 1.10.0+ 1.0 1.9.1.+
docker-compose.yaml同级目录:
docker-compose up -d (默认为docker-compose.yaml) docker-compose -f foobar.yml up -d docker-compose up
停止命令:
docker-compose down
删除命令:
docker-compose rm
重启命令:
docker-compose restart
查看状态:
docker-compose ps
2 docker-compose安装cmdbuild:
[root@new-dev-02 cmdbuild]# cat 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=cmdbuild123 networks: - cmdbuild-network networks: cmdbuild-network: driver: bridge
[root@new-dev-02 cmdbuild]# docker-compose up -d [root@new-dev-02 cmdbuild]# 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 [root@new-dev-02 cmdbuild]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 42056b0a954f quentinv/cmdbuild:latest "catalina.sh run" 2 minutes ago Up About a minute 0.0.0.0:8080->8080/tcp cmdbuild_tomcat_1 6d6a5bfb202b postgres:9.3 "docker-entrypoint.s…" 2 minutes ago Up About a minute 5432/tcp cmdbuild_pgsql_1
(上图的数据库名称重复了,需要修改下,在此我修改为了:cmdbuild)
(到此,整个cmdbuild的搭建工作就算完成了,下一节,将着手建模。)