docker-compose常用配置

0

version: "3.1"

services:

  redis:
    container_name: redis
    image: redis:6.2.6
    restart: always
    privileged: true
    command: redis-server /etc/redis/redis.conf
    ports:
      - 6379:6379
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - $PWD/redis/data:/data
      - $PWD/redis/redis.conf:/etc/redis/redis.conf
    environment:
      - TZ=Asia/Shanghai

  nacos:
    container_name: nacos
    image: nacos/nacos-server:v2.0.3
    restart: always
    privileged: true
    ports:
      - 8848:8848
      - 9848:9848
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - $PWD/nacos/logs/:/home/nacos/logs
      - $PWD/nacos/init.d/custom.properties:/home/nacos/init.d/custom.properties
    environment:
      - TZ=Asia/Shanghai
      - MODE=standalone
      - PREFER_HOST_MODE=hostname

  neo4j:
    container_name: neo4j
    image: neo4j:4.4.0-community
    restart: always
    privileged: true
    ports:
      - 7474:7474
      - 7687:7687
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - $PWD/neo4j/data:/data
      - $PWD/neo4j/logs:/logs
      - $PWD/neo4j/conf:/var/lib/neo4j/conf
    environment:
      - TZ=Asia/Shanghai
      - NEO4J_AUTH=none

  mysql:
    container_name: mysql
    image: mysql:8.0.21
    restart: always
    privileged: true
    ports:
      - 3306:3306
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - $PWD/mysql/data:/var/lib/mysql
      - $PWD/mysql/conf.d:/etc/mysql/conf.d
    environment:
      TZ: Asia/Shanghai
      MYSQL_ROOT_PASSWORD: 
      MYSQL_ALLOW_EMPTY_PASSWORD: root

  acgist:
    container_name: acgist
    image: openjdk:11.0.13-jre
    restart: always
    privileged: true
    command: sh /data/app/bin/startup.sh;/wait-for acgist:8080 -- echo 'success'
    links:
      - 相同compose服务
    expose:
      - 8080
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - $PWD/acgist:/data/app
      - $PWD/wait-for:/wait-for
    depends_on:
      - 依赖服务
    environment:
      - TZ=Asia/Shanghai
    external_links:
      - redis
      - neo4j
      - nacos
      - mysql

networks:
  acgist_network:
    external: true
  default:
    name: acgist_network