1. 程式人生 > 其它 >Docker: docker-compose

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