Location>code7788 >text

docker-compose

Popularity:930 ℃/2025-03-21 14:18:50
version: '3.8' services: mysql: image: mysql:5.7.43 container_name: mysql environment: MYSQL_ROOT_PASSWORD: root TZ: Asia/Shanghai Ports: - "3306:3306" Volumes: - /opt/docker/mysql/config/:/etc/mysql// - /opt/docker/mysql/data:/var/lib/mysql - /opt/docker/mysql/logs:/var/log/mysql - /etc/localtime:/etc/localtime:ro # Map time file - /etc/timezone:/etc/timezone:ro # Map time zone description file restart: always # # [mysqld] # character-set-server = utf8mb4 # collation-server = utf8mb4_general_ci # max_connections = 1000 # innodb_buffer_pool_size = 1G # [client] # default-character-set = utf8mb4 redis: image: redis:7 container_name: redis restart: always environment: - TZ=Asia/Shanghai # Set container time zone Ports: - "6379:6379" Volumes: - /opt/docker/redis/data:/data # Data persistence directory - /opt/docker/redis/conf/:/usr/local/etc/redis/ # Configuration file - /opt/docker/redis/logs:/var/log/redis # Log Directory - /etc/localtime:/etc/localtime:ro # Host time synchronization Command: redis-server /usr/local/etc/redis/ # ## Basic configuration # bind 0.0.0.0 # port 6379 # timeout 0 # tcp-keepalive 300 # # Security Configuration # requirepass Cc68db0e # # Persistent configuration # save 900 1 # save 300 10 # save 60 10000 # stop-writes-on-bgsave-error no # rdbcompression yes # rdbchecksum yes #dbfilename # dir /data # # Memory Management # maxmemory 2gb # maxmemory-policy allkeys-lru # # Log configuration # loglevel notice # logfile /var/log/redis/ # # Other optimizations # daemonize no # protected-mode no # appendonly yes # appendfsync everysec elasticsearch: image: elasticsearch:8.13.4 # Specified version (recommended to be consistent with Kibana version) container_name: elasticsearch restart: always environment: - =single-node # Single node mode - ES_JAVA_OPTS=-Xms2g -Xmx2g # JVM memory allocation - TZ=Asia/Shanghai # Time zone configuration - ELASTIC_PASSWORD=Cc68db0e # Password must be set - =true # Enable security features # - =false # Disable HTTPS (test environment) ulimits: memlock: soft: -1 hard: -1 Volumes: - /opt/docker/es/data:/usr/share/elasticsearch/data # Data directory - /opt/docker/es/config/:/usr/share/elasticsearch/config/ # Configuration file - /opt/docker/es/plugins:/usr/share/elasticsearch/plugins # Plugins Directory - /opt/docker/es/certs:/usr/share/elasticsearch/config/certs # Certificate Directory - /etc/localtime:/etc/localtime:ro # Host time synchronization Ports: - "9200:9200" # HTTP API - "9300:9300" # Node communication # #: my-es-cluster #: node-1 #: 0.0.0.0 # ## Security configuration (automatically generate certificates) ## #: ## # enabled: true ## # : certs/http.p12 ## # : certs/http.p12 ## ## # Memory lock configuration #bootstrap.memory_lock: true # ## # Cross-domain configuration (when visualization tools are needed) #: true #-origin: "*" nacos: image: nacos/nacos-server:v2.5.1 # Specify a stable version container_name: nacos-server environment: MODE: standalone # standalone mode SPRING_DATASOURCE_PLATFORM: mysql MYSQL_SERVICE_HOST: 10.10.10.20 # Use service name to communicate MYSQL_SERVICE_PORT: 3306 MYSQL_SERVICE_DB_NAME: nacos_config MYSQL_SERVICE_USER: root MYSQL_SERVICE_PASSWORD: root NACOS_AUTH_ENABLE: "true" # Enable authentication NACOS_AUTH_TOKEN: SecretKey0123456789012345678901234567890123456789012345678901234567890123456789 # Custom Token (must be modified for production) NACOS_AUTH_IDENTITY_KEY: nacosAuthIdentityKey NACOS_AUTH_IDENTITY_VALUE: nacosAuthIdentityValue JVM_XMS: 1g # Initial heap memory JVM_XMX: 1g # Maximum heap memory TZ: Asia/Shanghai # Time Zone Ports: - "8848:8848" # Web Console - "9848:9848" # gRPC communication Volumes: - /opt/docker/nacos/logs:/home/nacos/logs - /opt/docker/nacos/conf:/home/nacos/conf # Custom configuration file mount