项目常用docker部署

kafka

docker-compose.yml

version: '2'
services:
  zookeeper:
    image: wurstmeister/zookeeper
    ports:
      - "2181:2181"
  kafka:
    image: wurstmeister/kafka:2.12-2.2.1
    ports:
      - "9092:9092"
    environment:
      KAFKA_ADVERTISED_HOST_NAME: 192.168.1.2
      KAFKA_CREATE_TOPICS: "my_topic1:8:1,my_topic2:8:1"
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

mysql

docker-compose.yml

version: '2'
services:
    mysql:
        network_mode: "host"
        environment:
            MYSQL_ROOT_PASSWORD: "yourpassword"
            MYSQL_USER: 'test'
            MYSQL_PASS: 'yourpassword'
        image: "docker.io/mysql:latest" 
        restart: always
        volumes:
            - "./db:/var/lib/mysql"
            - "./conf/my.cnf:/etc/my.cnf"
            - "./init:/docker-entrypoint-initdb.d/"

redis

docker-compose.yml

---
version: '3'
services:
  redis:
    image: redis:4.0.13 
    container_name: redis
    restart: always
    command: --appendonly yes
    ports:
      - 6379:6379
    volumes:
      - ./redis_data:/data

elasticsearch

docker-compose.yml

version: '2.2'
services:
  es1:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.6.1
    container_name: es1
    environment:
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    ports:
      - 9200:9200
      - 9300:9300
    networks:
      - esnet
      
  es2:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.6.1
    container_name: es2
    environment:
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
      - "discovery.zen.ping.unicast.hosts=es1"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    networks:
      - esnet

  kibana:
    image: docker.elastic.co/kibana/kibana:6.6.1
    container_name: kibana
    ports:
      - 5601:5601
    environment:
      - ELASTICSEARCH_URL=http://es1:9200
    networks:
      - esnet

networks:
  esnet:

clickhouse

docker run -d --name clickhouse-server --ulimit nofile=262144:262144 -p 9000:9000 yandex/clickhouse-server:1.1

nginx

docker-compose.yml

version: '2.0'

services:
  nginx:
    restart: always
    image: nginx:1.11.6-alpine
    ports:
      - 8080:80
      - 80:80
      - 443:443
    volumes:
      - ./conf.d:/etc/nginx/conf.d
      - ./log:/var/log/nginx
      - ./www:/var/www
      - /etc/letsencrypt:/etc/letsencrypt

tomcat

docker-compose.yml

version: '3'
services:
  tomcat:
    restart: always
    image:tomcat
    container_name: tomcat
    ports:
      - 8080:8080
    volumes:
      - /usr/local/docker/myweb/webapps/:/usr/local/tomcat/webapps/
    environment:
      TZ: Asia/Shanghai

nexus

docker-compose.yml

version: "3.7"
services:
  nexus:
     restart: "always" 
     image: sonatype/nexus3
     container_name: nexus
     ports:
       - 8081:8081 
     volumes:
       - /usr/local/docker/nexus/nexus-data:/nexus-data

你可能感兴趣的:(docker)