docker安装 es 和 docker-compose

mac安装 docker

下载地址 https://www.docker.com/products/docker-desktop

添加国内镜像

  • ustc http://docker.mirrors.ustc.edu.cn
  • 网易 http://hub-mirror.c.163.com
  • docker官方中国区 https://registry.docker-cn.com
    image.png

http://registry.docker-cn.com http前不要加s,不然会出现“No certs for egitstry.docker.com”错误
https://www.jianshu.com/p/94c6e44ebd3c

安装 docker compose

Mac 版的 docker 已经集成了 docker compose 不需要额外安装
https://docs.docker.com/compose/install/

作用:docker 中运行多个服务,每个都要手动启停会很麻烦,docker compose 可以轻松、高效的管理这些容器

删除一个镜像

要先删除 这个镜像对应的容器,再删除此镜像

  • 查看所有容器
    docker ps -a
    image.png
  • 删除容器
    docker rm f74c569f6a04 f74c569f6a04是容器 id
  • 删除镜像


    image.png

docker 拉取 elasticsearch 7.1.0 镜像

docker pull docker.elastic.co/elasticsearch/elasticsearch:7.1.0
https://www.elastic.co/guide/en/elasticsearch/reference/6.7/docker.html

增加 docker-compose.yml文件
touch docker-compose.yml

image.png

文件内容

version: '2.2'
services:
  cerebro:
    image: lmenezes/cerebro:0.8.3
    container_name: cerebro
    ports:
      - "9000:9000"
    command:
      - -Dhosts.0.host=http://elasticsearch:9200
  kibana:
    image: docker.elastic.co/kibana/kibana:7.1.0
    container_name: kibana7
    environment:
      - I18N_LOCALE=zh-CN
      - XPACK_GRAPH_ENABLED=true
      - TIMELION_ENABLED=true
      - XPACK_MONITORING_COLLECTION_ENABLED="true"
    ports:
      - "5601:5601"
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.1.0
    container_name: es7_01
    environment:
      - cluster.name=zjc-es-cluster
      - node.name=es7_01
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - discovery.seed_hosts=es7_01
      - cluster.initial_master_nodes=es7_01,es7_02
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - es7data1:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
  elasticsearch2:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.1.0
    container_name: es7_02
    environment:
      - cluster.name=zjc-es-cluster
      - node.name=es7_02
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - discovery.seed_hosts=es7_01
      - cluster.initial_master_nodes=es7_01,es7_02
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - es7data2:/usr/share/elasticsearch/data
volumes:
  es7data1:
    driver: local
  es7data2:
    driver: local

Docker:Docker Compose 详解
https://www.jianshu.com/p/658911a8cff3

你可能感兴趣的:(docker安装 es 和 docker-compose)