zoukankan      html  css  js  c++  java
  • docker-compose.yml 安装 nginx、pgsql、redis、mq等配置

    一、开发环境

    1. nginx
    2. pgsql
    3. rocketmq
    4. 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
    
    
  • 相关阅读:
    Arial Monospaced
    也玩有道难题的双立方数问题:Python 版解法
    用 VB.NET 实现的非确定性计算例子
    Gestalt 在浏览器里用 python/ruby 写客户端脚本
    非确定性计算引擎转化为C#版本并重构
    再谈C#的装箱和拆箱
    谈谈.Net 4.0 中的委托delegate
    在C#中使用SqlDbType.Xml类型参数
    java cmd编译class文件
    Mysql、Oracle插表关于主键的处理
  • 原文地址:https://www.cnblogs.com/nm666/p/14489939.html
Copyright © 2011-2022 走看看