常用和微服务中间件docker-compose

常用和微服务中间件docker-compose

满足基本场景的练习使用,若希望博主添加新的中间件可以下方评论区留言

使用展示

  • container list
    常用和微服务中间件docker-compose_第1张图片
  • redis-cli
    常用和微服务中间件docker-compose_第2张图片

docker-compose.yml

version: '3'

services:
  portainer:
    image: portainer/portainer
    restart: always
    ports:
      - "9000:9000"
    command: -H unix:///var/run/docker.sock
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_data:/data
  mysql:
    restart: always
    image: mysql:5.7.16
    container_name: node01_mysql
    networks:
      - node01-network
    volumes:
      - ./mysql/data/:/var/lib/mysql/
      - ./mysql/conf/:/etc/mysql/conf.d/
      - ./mysql/logs/:/data/mysql/logs/
    environment:
      - "MYSQL_ROOT_PASSWORD=111111"
      - "MYSQL_DATABASE=nacos_db"
      - "TZ=UTC"
    ports:
      - 3306:3306
  redis:
    image: redis:6.2.6
    container_name: node01_redis
    networks:
      - node01-network
    volumes:
      - ./redis/datadir/:/data
      - ./redis/conf/redis.conf:/usr/local/etc/redis/redis.conf
      - ./redis/logs/:/logs
    ports:
      - 6379:6379
  rabbitmq:
    image: rabbitmq:3.9.13-management
    container_name: node01-rabbitmq
    restart: always
    networks:
      - node01-network
    ports:
      - 15672:15672
      - 5672:5672
    volumes:
      - ./rabbitmq/data/:/var/lib/rabbitmq
    environment:
      - RABBITMQ_DEFAULT_USER=root
      - RABBITMQ_DEFAULT_PASS=111111
  nacos:
    image: nacos/nacos-server
    container_name: node01_nacos
    restart: always
    networks:
      - node01-network
    environment:
      - PREFER_HOST_MODE=hostname
      - MODE=standalone
      - SPRING_DATASOURCE_PLATFORM=mysql
      - MYSQL_SERVICE_HOST=mysql
      - MYSQL_SERVICE_DB_NAME=nacos_db
      - MYSQL_SERVICE_PORT=3306
      - MYSQL_SERVICE_USER=root
      - MYSQL_SERVICE_PASSWORD=111111
      - MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&serverTimezone=UTC
    volumes:
      - ./nacos/logs/:/home/nacos/logs
      - ./nacos/init.d/custom.properties:/home/nacos/init.d/custom.properties
    ports:
      - "8848:8848"
      - "9848:9848"
      - "9555:9555"
    depends_on:
      - mysql
  dubbo-admin:
    image: apache/dubbo-admin
    restart: always
    container_name: node01_dubbo
    ports:
      - 9001:8080
    networks:
      - node01-network
    environment:
      - admin.root.user.name=root
      - admin.root.user.password=111111
      - admin.registry.address=nacos://nacos:8848?group=DEFAULT_GROUP&namespace=node01
      - admin.config-center=nacos://nacos:8848?group=DEFAULT_GROUP&namespace=node01
      - admin.metadata-report.address=nacos://nacos:8848?group=dubbo&namespace=node01
    cpu_count: 1
    mem_limit: 512m
    depends_on:
      - nacos
  zookeeper:
    image: zookeeper
    restart: always
    container_name: node01_zookeeper
    networks:
      - node01-network
    ports:
      - 2181:2181
  nginx:
    image: nginx
    restart: always
    container_name: node01_nginx
    networks:
      - node01-network
    environment:
      TZ: UTC
    volumes:
      - ./nginx/html/:/usr/share/nginx/html/
      - ./nginx/conf/:/etc/nginx/conf.d/
      - ./nginx/cache/:/var/cache/nginx/
    ports:
      - "80:80"
  elasticsearch:
    image: elasticsearch:7.17.1
    container_name: node01_elasticsearch
    privileged: true
    environment:
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    volumes:
      - ./elasticsearch/data:/usr/share/elasticsearch/data
      - /etc/localtime:/etc/localtime
      - ./elasticsearch/plugins/:/usr/share/elasticsearch/plugins/
    networks:
      - node01-network
    hostname: elasticsearch
    restart: always
    ports:
      - 9200:9200
      - 9300:9300
  kibana:
    image: kibana:7.17.1
    container_name: node01_kibana
    networks:
      - node01-network
    environment:
      - elasticsearch.hosts=http://elasticsearch:9200
    hostname: kibana
    depends_on:
      - elasticsearch
    restart: always
    ports:
      - "5601:5601"
  logstash:
    image: logstash:7.17.1
    container_name: node01_logstash
    networks:
      - node01-network
    hostname: logstash
    restart: always
    depends_on:
      - elasticsearch
    ports:
      - 9600:9600
      - 5044:5044


volumes:
  portainer_data:
networks:
  node01-network:


启动使用

docker-compose up -d
# 访问host:9000 进入portainer界面

你可能感兴趣的:(docker,docker,微服务,中间件)