一、开发环境
- nginx
- pgsql
- rocketmq
- redis
version: '3.1'
services:
nginx:
restart: always
image: nginx
container_name: nginx # 指定容器名称
ports:
- 11111:80
- 443:443
volumes:
- /home/geo/geo-test/docker-volumes/nginx/conf.d:/etc/nginx/conf.d
- /home/geo/geo-test/docker-volumes/nginx/html:/usr/share/nginx/html
- /home/geo/geo-test/docker-volumes/nginx/log:/var/log/nginx
postgresql_base: # 服务的名称 {postgresql_后面加自定义库名称}
restart: always # 代表只要Docker启动,那么这个容器就跟着一起启动
image: postgres:10.14 # 指定镜像路径
container_name: pg_base # 指定容器名称 此处pg_后面加{自定义库名称}
ports:
- 54321:5432 # 指定端口号的映射
environment:
POSTGRES_USER: root
POSTGRES_DB: database
POSTGRES_PASSWORD: 123456
TZ: Asia/Shanghai # 指定时区
volumes:
- /home/geo/geo-test/docker-volumes/postgres/pg_base_data:/var/lib/postgresql/data # 映射数据卷 pg_{自定义库名称}_data
rmqnamesrv: # rocketMQ的 nameserver 路由管理器
image: foxiswho/rocketmq:server
container_name: rmqnamesrv
ports:
- 9876:9876
volumes:
- /home/geo/geo-test/docker-volumes/rocketmq/logs:/opt/logs
- /home/geo/geo-test/docker-volumes/rocketmq/store:/opt/store
rmqbroker: # rocketMQ的 broker
image: foxiswho/rocketmq:broker
container_name: rmqbroker
ports:
- 10909:10909
- 10911:10911
volumes:
- /home/geo/geo-test/docker-volumes/rocketmq/logs:/opt/logs
- /home/geo/geo-test/docker-volumes/rocketmq/store:/opt/store
- /home/geo/geo-test/docker-volumes/rocketmq/brokerconf/broker.conf:/etc/rocketmq/broker.conf
environment:
NAMESRV_ADDR: "rmqnamesrv:9876"
JAVA_OPTS: " -Duser.home=/opt"
JAVA_OPT_EXT: "-server -Xms128m -Xmx128m -Xmn128m" #这里为了测试调小了配置,生产环境需要调大 8g 8g 4g
command: mqbroker -c /etc/rocketmq/broker.conf
depends_on:
- rmqnamesrv
rmqconsole: # rocketMQ的 消息监视平台
image: styletang/rocketmq-console-ng
container_name: rmqconsole
ports:
- 8849:8080
environment:
JAVA_OPTS: "-Drocketmq.namesrv.addr=rmqnamesrv:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false"
depends_on:
- rmqnamesrv
redis: #redis
image: daocloud.io/library/redis:latest
container_name: redis
command:
redis-server /etc/redis/redis.conf --appendonly yes
ports:
- "6379:6379"
volumes:
- /home/geo/geo-test/docker-volumes/redis/data:/data
- /home/geo/geo-test/docker-volumes/redis/redis.conf:/etc/redis/redis.conf:rw
二、常用工具
mysql、gogs、jenkins、mongo、yapi、nexus、nginx
version: '3.1'
services:
mysql: # 服务的名称
restart: always # 代表只要Docker启动,那么这个容器就跟着一起启动
image: mysql:5.7 # 指定镜像路径
container_name: mysql # 指定容器名称
#network_mode: 'host'
ports:
- 3306:3306 # 指定端口号的映射
environment:
MYSQL_ROOT_PASSWORD: root # 指定MySQL的ROOT用户登录密码
TZ: Asia/Shanghai # 指定时区
volumes:
- /home/geo/geo-tools/docker-volumes/mysql/data:/var/lib/mysql
- /home/geo/geo-tools/docker-volumes/mysql/conf:/etc/mysql/conf.d
gogs:
restart: always # 代表只要Docker启动,那么这个容器就跟着一起启动
image: daocloud.io/daocloud/gogs:0.11.19 # 指定镜像路径
container_name: gogs # 指定容器名称
#depends_on:
# - mysql
network_mode: 'host'
#ports:
# - 3000:3000 # 指定端口号的映射
#links:
# - mysql
environment:
TZ: Asia/Shanghai # 指定时区
volumes:
# - /home/geo/geo-tools/docker-volumes/gogs:/var/gogs # 映射数据卷
- /home/geo/geo-tools/docker-volumes/gogs/data:/data
jenkins:
container_name: jenkins
image: 'jenkins/jenkins:2.275'
restart: always
environment:
- TZ=Asia/Shanghai
#network_mode: 'host'
ports:
- '8888:8080'
- '50001:50000'
volumes:
- /home/geo/geo-tools/docker-volumes/jenkins/home:/var/jenkins_home
- /home/geo/geo-tools/maven/apache-maven-3.5.4:/var/maven
mongo:
container_name: mongo
image: mongo
restart: always
environment:
- TZ=Asia/Shanghai
#network_mode: 'host'
ports:
- '27017:27017'
volumes:
- /home/geo/geo-tools/docker-volumes/mongo/data:/data/db
yapi:
container_name: yapi
image: registry.cn-shenzhen.aliyuncs.com/tool-hub/yapi:1.8.9
links:
- mongo
restart: always
#network_mode: 'host'
ports:
- '3001:3000'
working_dir: /api/vendors
command: server/app.js
nexus:
container_name: nexus
image: 'sonatype/nexus3'
restart: always
environment:
- TZ=Asia/Shanghai
ports:
- '8081:8081'
volumes:
- /home/geo/geo-tools/docker-volumes/nexus/data:/nexus-data
nginx:
restart: always
image: nginx
container_name: nginx # 指定容器名称
network_mode: 'host'
#ports:
# - 80:80
# - 443:443
volumes:
- /home/geo/geo-tools/docker-volumes/nginx/conf.d:/etc/nginx/conf.d
- /home/geo/geo-tools/docker-volumes/nginx/html:/usr/share/nginx/html
- /home/geo/geo-tools/docker-volumes/nginx/log:/var/log/nginx