Docker: docker-compose

复制代码
version: "3.9"

volumes:
  data:
    external: false
  config:
    external: false
  plugins:
    external: false
  kibana:
    external: false

networks:
  demo:
    name: demo
    external: false
    ipam:
      driver: default
      config:
        - subnet: 10.0.0.0/24

services:
  elasticsearch:
    container_name: elasticsearch
    image: elasticsearch:8.1.0
    ports:
      - 9200:9200
      - 9300:9300
    networks:
      - elasticsearch
    environment:
      - discovery.type=single-node
      - ES_JAVA_OPTS=-Xms512m -Xmx512m
    volumes:
      - data:/usr/share/elasticsearch/data
      - config:/usr/share/elasticsearch/config
      - plugins:/usr/share/elasticsearch/plugins
  kibana:
    container_name: kibana
    image: kibana:8.1.0
    ports:
      - 5601:5601
    networks:
      - elasticsearch
    volumes:
      - kibana:/usr/share/kibana/config
    depends_on:
      - elasticsearch
  demo:
    build:
      context: demo # Dockerfile所在目录
      dockerfile: Dockerfile
    container_name: demo
    deploy:
      replicas: 1
      resources:
        limits:
          cpus: "0.50"
          memory: 500M
        reservations:
          memory: 500M
      restart_policy:
        condition: on-failure
        max_attempts: 3
    dns:
      - 8.8.8.8
      - 9.9.9.9
    dns_search:
      - dc1.example.com
      - dc2.example.com
    entrypoint: /code/entrypoint.sh
    entrypoint: ["php", "-d", "memory_limit=-1", "vendor/bin/phpunit"]
    env_file:
      - ./common.env
      - ./apps/web.env
      - /opt/runtime_opts.env
    command: "redis-server --appendonly yes"
    ports:
      - target: 80
        published: 8080
        protocol: tcp
        mode: host
    healthcheck:
      test: ['CMD','curl','-f','http://localhost']
      interval: 1m30s
      timeout: 10s
      retries: 3
    sysctls:
      - net.core.somaxconn=1024
      - net.ipv4.tcp_syncookies=0
    ulimits:
      nproc: 65535
      nofile:
        soft: 20000
        hard: 40000
    logging:
      driver: "json-file"
      options:
        max-size: "200k"
        max-file: "10"
    volumes:
      - type: volume
        source: mydata
        target: /data
        volume:
          nocopy: true
      - type: bind
        source: ./static
        target: /opt/app/static
复制代码

 

posted @   ascertain  阅读(57)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
历史上的今天:
2021-03-20 选项卡,类
2021-03-20 渐隐渐现轮播图
点击右上角即可分享
微信分享提示