菜单

docker-compose部署常用组件

duckflew
发布于 2022-08-11 / 154 阅读
0
0

docker-compose部署常用组件

常用的数据库

tips: redis需要手动在配置文件中指定日志文件

version: "3.6"
services:
  mysql1:
    image: mysql:5.7
    environment:
      MYSQL_DATABASE: 'db'
      MYSQL_ROOT_PASSWORD: '123456'
      MYSQL_ROOT_HOST: '%'
    ports:
      - '3306:3306'
    expose:
      - '3306'
    volumes:
      - /d/db/mysql/mysql1/config/my.cnf:/etc/my.cnf
      - /d/db/mysql/mysql1/data:/var/lib/mysql/
  mysql2:
    image: mysql:5.7
    environment:
      MYSQL_DATABASE: 'db'
      MYSQL_ROOT_PASSWORD: '123456'
      MYSQL_ROOT_HOST: '%'
    ports:
      - '3307:3306'
    expose:
      - '3307'
    volumes:
      - /d/db/mysql/mysql2/config/my.cnf:/etc/my.cnf
      - /d/db/mysql/mysql2/data:/var/lib/mysql/
  pg1:
    image: postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: 123456
    ports:
      - 5432:5432
  redis1:
    image: redis
    volumes:
      - /d/db/redis/data:/data
      - /d/db/redis/config:/usr/local/etc/redis
      - /d/db/redis/logs/redis1_6379.log:/var/log/redis/redis1_6379.log
    command: redis-server /usr/local/etc/redis/redis.conf
    ports:
      - "6379:6379"

gitlab和jenkins

version: "3.6"
services:
  jenkins:
    image: jenkinsci/blueocean
    ports:
      - '8080:8080'
      - '50000:50000'
    expose:
      - '8080'
    volumes:
      - /d/jenkins/data:/var/jenkins_home
  gitlab:
    image: 'twang2218/gitlab-ce-zh:11.1.4'
    container_name: "gitlab"
    restart: unless-stopped
    privileged: true
    hostname: 'gitlab'
    environment:
      TZ: 'Asia/Shanghai'
      GITLAB_OMNIBUS_CONFIG: |
        gitlab_rails['time_zone'] = 'Asia/Shanghai'
        gitlab_rails['smtp_enable'] = true
        gitlab_rails['smtp_address'] = "smtp.qq.com"
        gitlab_rails['smtp_port'] = 465
        gitlab_rails['smtp_user_name'] = "1297087462@qq.com"  #用自己的邮箱
        gitlab_rails['smtp_password'] = "邮箱授权码"
        gitlab_rails['smtp_domain'] = "qq.com"
        gitlab_rails['smtp_authentication'] = "login"
        gitlab_rails['smtp_enable_starttls_auto'] = true
        gitlab_rails['smtp_tls'] = true
        gitlab_rails['gitlab_email_from'] = '1297087462@qq.com'
        gitlab_rails['gitlab_shell_ssh_port'] = 22
    ports:
      - '80:80'
      - '443:443'
      - '22:22'
    volumes:
      - /d/gitlab/config:/etc/gitlab
      - /d/gitlab/data:/var/opt/gitlab
      - /d/gitlab/logs:/var/log/gitlab

RabbitMQ

rabbitmq:
    image: rabbitmq:3.8-management
    container_name: "edu_rabbitmq"
    restart: always
    ports:
      - "5672:5672"
      - "15672:15672"
    environment:
      - RABBITMQ_DEFAULT_USER=root
      - RABBITMQ_DEFAULT_PASS=123456
    volumes:
      - /d/db/rabbitmq:/var/lib/rabbitmq

haddop集群

https://github.com/big-data-europe/docker-hadoop.git

ES和kibana

注意: 第一次启动需要先注释掉挂载点,启动过一次之后把容器内的挂载内容复制出来再重新挂载 否则会报各种文件找不到的错误

version: "3.8"
networks:
  es:
services:
  elasticsearch:
    image: elasticsearch:7.14.0
    container_name: elasticsearch
    ports:
      - "9200:9200"
      - "9300:9300"
    networks:
      - "es"
    environment:
      - "discovery.type=single-node"
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    volumes:
      - /d/es/data:/usr/share/elasticsearch/data
      - /d/es/config:/usr/share/elasticsearch/config
      - /d/es/plugins:/usr/share/elasticsearch/plugins
  kibana:
    image: kibana:7.14.0
    ports:
      - "5601:5601"
    networks:
      - "es"
    volumes:
      - /d/es/kibana/config:/usr/share/kibana/config
kibana配置文件
server.host: "0"
server.shutdownTimeout: "5s"
elasticsearch.hosts: ["http://elasticsearch:9200"]
monitoring.ui.container.elasticsearch.enabled: true

评论