常用工具使用docker创建(rabbitmq,elk,邮件服务器,monogodb,mindoc)
1、RabbitMQ
docker run -d --name rabbitmq3.7.7 -p 5672:5672 -p 15672:15672 -v `pwd`/data:/var/lib/rabbitmq --hostname myRabbit -e RABBITMQ_DEFAULT_VHOST=my_vhost -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin df80af9ca0c9
2、elk 6.8.0 无问题,7.0 以后版本 kibana需要 进入容器后进行相应的配置
ES:
docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e “discovery.type=single-node” elasticsearch:6.8.0
Kibana
docker run -d -p 5601:5601 --name kibana --link elasticsearch:elasticsearch docker.io/kibana:6.8.0
---------------------------------------------
7.0.0以上多节点es,使用docker-compose
https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
version: '2.2' services: es01: image: docker.elastic.co/elasticsearch/elasticsearch:7.5.1 container_name: es01 environment: - node.name=es01 - cluster.name=es-docker-cluster - discovery.seed_hosts=es02,es03 - cluster.initial_master_nodes=es01,es02,es03 - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" ulimits: memlock: soft: -1 hard: -1 volumes: - data01:/usr/share/elasticsearch/data ports: - 9200:9200 networks: - elastic es02: image: docker.elastic.co/elasticsearch/elasticsearch:7.5.1 container_name: es02 environment: - node.name=es02 - cluster.name=es-docker-cluster - discovery.seed_hosts=es01,es03 - cluster.initial_master_nodes=es01,es02,es03 - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" ulimits: memlock: soft: -1 hard: -1 volumes: - data02:/usr/share/elasticsearch/data networks: - elastic es03: image: docker.elastic.co/elasticsearch/elasticsearch:7.5.1 container_name: es03 environment: - node.name=es03 - cluster.name=es-docker-cluster - discovery.seed_hosts=es01,es02 - cluster.initial_master_nodes=es01,es02,es03 - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" ulimits: memlock: soft: -1 hard: -1 volumes: - data03:/usr/share/elasticsearch/data networks: - elastic volumes: data01: driver: local data02: driver: local data03: driver: local networks: elastic: driver: bridge
kibana 7.5.1
https://www.elastic.co/guide/en/kibana/current/docker.html
version: '2.2' services: kibana: image: docker.elastic.co/kibana/kibana:7.5.1 volumes: - ./kibana.yml:/myelk/kibana.yml environment: sticsearch.hosts: http//自己的ip:9200 container_name: kibana01 ports: - 5601:5601
此时访问kibana 可能出现Kibana is not ready.此时进入容器修改config (退出容器:exit)
docker exec -it kibana01 /bin/bash
找到 config下的kibana.yml文件修改配置 (参考https://www.cnblogs.com/zlslch/p/6614033.html),主要修改
server.host: "自己的ip" server.port: 5601 elasticsearch.url: "http://自己的ip:9200" kibana.index: ".kibana" server.host 我设置成0.0.0.0 成功了
3、邮件服务器
https://github.com/bestwu/ewomail
新建dockers-compose.yml 文件 并执行,docker-compose up -d
mail: image: bestwu/ewomail hostname: mail.ewomail.com container_name: myewomail restart: always ports: - "25:25" - "143:143" - "587:587" - "993:993" - "109:109" - "110:110" - "465:465" - "995:995" - "80:80" - "2812:2812" - "8080:8080" environment: - LANGUAGE=zh_CN volumes: - ./build/data/mysql:/ewomail/mysql/data - ./build/data/vmail:/ewomail/mail - ./build/data/rainloop:/ewomail/www/rainloop/data - ./build/data/ssl/certs/:/etc/ssl/certs/ - ./build/data/ssl/private/:/etc/ssl/private/ - ./build/data/ssl/dkim/:/ewomail/dkim/
4、monogodb
https://www.runoob.com/docker/docker-install-mongodb.html
1、运行容器
docker run -itd --name mongo -p 27017:27017 mongo --auth
2、设置账号密码并尝试连接
$ docker exec -it mongo mongo admin # 创建一个名为 admin,密码为 123456 的用户。 > db.createUser({ user:'admin',pwd:'123456',roles:[ { role:'userAdminAnyDatabase', db: 'admin'}]}); # 尝试使用上面创建的用户信息进行连接。 > db.auth('admin', '123456')
#登录管理员
> use admin
> db.auth("admin","123456")
#创建test库
> use test
> db.createUser({ user: "test", pwd: "test123", roles: [{ role: "dbOwner", db: "test" }] })
Successfully added user: {
"user" : "test",
"roles" : [
{
"role" : "dbOwner",
"db" : "test"
}
]
}
5、mindoc
https://github.com/lifei6671/mindoc
使用docker-compose
MinDoc_New: image: registry.cn-hangzhou.aliyuncs.com/mindoc/mindoc:v2.0-beta.2 privileged: false restart: always ports: - 8181:8181 volumes: - /var/www/mindoc/database:/mindoc/database - /var/www/mindoc/uploads:/mindoc/uploads environment: - MINDOC_RUN_MODE=prod - MINDOC_DB_ADAPTER=sqlite3 - MINDOC_DB_DATABASE=./database/mindoc.db - MINDOC_CACHE=true - MINDOC_CACHE_PROVIDER=file - MINDOC_ENABLE_EXPORT=false - MINDOC_BASE_URL= - MINDOC_CDN_IMG_URL= - MINDOC_CDN_CSS_URL= - MINDOC_CDN_JS_URL= dns: - 223.5.5.5 - 223.6.6.6