安装及使用见:
Centos7 docker docker-compose安装及镜像部署常用 *** 作_XYLANCC的博客-CSDN博客
docker-compose.yml
version: '3.3'
services:
nginx:
image: nginx:1.19.2
container_name: nginx
volumes:
- /etc/localtime:/etc/localtime:ro
- ./nginx/html:/usr/share/nginx/html:ro
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/logs:/var/log/nginx
- ./nginx/conf.d:/etc/nginx/conf.d
restart: always
ports:
- "80:80"
environment:
- NGINX_PORT=80
mysql:
image: mysql:5.7.30
container_name: mysql
volumes:
- /etc/localtime:/etc/localtime:ro
- ./mysql/data:/var/lib/mysql
- ./mysql/conf:/etc/mysql/conf.d
- ./mysql/logs:/logs
command: [
'mysqld',
'--innodb-buffer-pool-size=80M',
'--character-set-server=utf8mb4',
'--collation-server=utf8mb4_unicode_ci',
'--default-time-zone=+8:00',
'--lower-case-table-names=1'
]
restart: always
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
# MYSQL_DATABASE: db_manage
# MYSQL_USER: dev_user
# MYSQL_PASSWORD: dev_user
tomcat:
image: tomcat:9.0.59-jdk8
container_name: tomcat
volumes:
- /etc/localtime:/etc/localtime:ro
- ./tomcat/webapps:/usr/local/tomcat/webapps
- ./tomcat/logs:/usr/local/tomcat/logs
environment:
TZ: Asia/Shanghai
restart: always
ports:
- "8080:8080"
redis:
image: redis
container_name: redis
volumes:
- /etc/localtime:/etc/localtime:ro
- ./redis/data:/data
- ./redis/conf/redis.conf:/usr/local/redis/redis.conf
command: redis-server /usr/local/redis/redis.conf
restart: always
ports:
- "6379:6379"
#部署rocketmq------start------
rmqnamesrv:
image: foxiswho/rocketmq:server
container_name: rmqnamesrv
ports:
- 9876:9876
volumes:
- ./rocketmq/logs:/opt/logs
- ./rocketmq/store:/opt/store
rmqbroker:
image: foxiswho/rocketmq:broker
container_name: rmqbroker
ports:
- 10909:10909
- 10911:10911
volumes:
- ./rocketmq/logs:/opt/logs
- ./rocketmq/store:/opt/store
- ./rocketmq/brokerconf/broker.conf:/etc/rocketmq/broker.conf
environment:
NAMESRV_ADDR: "rmqnamesrv:9876"
JAVA_OPTS: " -Duser.home=/opt"
JAVA_OPT_EXT: "-server -Xms128m -Xmx128m -Xmn128m"
command: mqbroker -c /etc/rocketmq/broker.conf
depends_on:
- rmqnamesrv
rmqconsole:
image: styletang/rocketmq-console-ng
container_name: rmqconsole
ports:
- 18080:18080
environment:
JAVA_OPTS: "-Drocketmq.namesrv.addr=rmqnamesrv:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false"
depends_on:
- rmqnamesrv
#部署rocketmq------end------
memecached:
image: memcached:1.6.7
container_name: memcached
volumes:
- /etc/localtime:/etc/localtime:ro
restart: always
ports:
- "21605:11211"
mongo:
image: mongo:4.4.1
container_name: mongo
volumes:
- /etc/localtime:/etc/localtime:ro
- ./mongo/config:/etc/mongo # 挂载配置目录
- ./mongo/db:/data/db # 挂载数据目录
- ./mongo/log:/var/log/mongodb # 挂载日志目录
restart: always
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: Admin2020
clickhouse:
image: yandex/clickhouse-server:20.6.6.7
container_name: ${COMMON_DEPLOY_ENV}-clickhouse
volumes:
- /etc/localtime:/etc/localtime:ro
- ./clickhouse-server:/var/lib/clickhouse yandex/clickhouse-server
restart: always
ports:
- "21607:8123"
#部署ELK------start------
elasticsearch:
image: elasticsearch:7.2.0
container_name: elasticsearch
privileged: true
user: root
environment:
#设置集群名称为elasticsearch
- cluster.name=elasticsearch
#以单一节点模式启动
- discovery.type=single-node
#设置使用jvm内存大小
- ES_JAVA_OPTS=-Xms512m -Xmx512m
volumes:
- ./docker_elk/elasticsearch/plugins:/usr/share/elasticsearch/plugins
- ./docker_elk/elasticsearch/data:/usr/share/elasticsearch/data
ports:
- 9200:9200
- 9300:9300
logstash:
image: logstash:7.2.0
container_name: logstash
ports:
- 4560:4560
privileged: true
environment:
- TZ=Asia/Shanghai
volumes:
#挂载logstash的配置文件
- ./docker_elk/logstash/logstash.conf:/usr/share/logstash/pipeline/logstash.conf
depends_on:
- elasticsearch
links:
#可以用es这个域名访问elasticsearch服务
- elasticsearch:es
kibana:
image: kibana:7.2.0
container_name: kibana
ports:
- 5601:5601
privileged: true
links:
#可以用es这个域名访问elasticsearch服务
- elasticsearch:es
depends_on:
- elasticsearch
environment:
#设置访问elasticsearch的地址
- elasticsearch.hosts=http://elasticsearch:9200
#部署ELK------end------
minio:
image: minio/minio:latest
container_name: minio
environment:
MINIO_ROOT_USER: admin
MINIO_ROOT_PASSWORD: 12345678
volumes:
- ./minio:/data
ports:
#暴露API接口
- 9000:9000
#暴露Web接口控制台端口
- 9001:9001
command: minio server /data --console-address ":9001"
gitlab:
image: 'twang2218/gitlab-ce-zh'
restart: always
hostname: '192.168.1.100' # 此处填写所在服务器ip
environment:
TZ: 'Asia/Shanghai'
# 此处 ip 须与上面 hostname 一致,端口号自定义
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://192.168.1.100'
gitlab_rails['gitlab_shell_ssh_port'] = 2222
unicorn['port'] = 8888
nginx['listen_port'] = 80
ports:
- '80:80'
- '8443:443'
- '2222:22'
volumes:
- ./gitlab/config:/etc/gitlab
- ./gitlab/data:/var/opt/gitlab
- ./gitlab/logs:/var/log/gitlab
nexus:
restart: always
image: sonatype/nexus3
container_name: nexus
ports:
- 8081:8081
volumes:
- ./nexus-data:/nexus-data
####registry:docker私服
registry:
image: registry
restart: always
container_name: registry
ports:
- 5000:5000
volumes:
- ./docker/registry/data:/var/lib/registry
#部署FastDFS文件服务器------start------
tracker:
image: season/fastdfs:1.2
container_name: tracker
restart: always
volumes:
- "./fastdfs/tracker_data:/fastdfs/tracker/data"
ports:
- "22122:22122"
command: "tracker"
storage:
image: season/fastdfs:1.2
container_name: storage
links:
- tracker
restart: always
volumes:
- "./fastdfs/storage.conf:/fdfs_conf/storage.conf"
- "./fastdfs/storage_base_path:/fastdfs/storage/data"
- "./fastdfs/store_path0:/fastdfs/store_path"
ports:
- "23000:23000"
environment:
TRACKER_SERVER: "tracker:22122"
command: "storage"
nginx:
image: season/fastdfs:1.2
container_name: fdfs-nginx
restart: always
volumes:
- "./fastdfs/nginx.conf:/etc/nginx/conf/nginx.conf"
- "./fastdfs/store_path0:/fastdfs/store_path"
links:
- tracker
ports:
- "8088:8088"
environment:
TRACKER_SERVER: "tracker:22122"
command: "nginx"
#部署FastDFS文件服务器------end------
配置网络示例
version: '3.3'
services:
nginx:
image: nginx:1.19.2
container_name: nginx
volumes:
- /etc/localtime:/etc/localtime:ro
- ./nginx/html:/usr/share/nginx/html:ro
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/logs:/var/log/nginx
- ./nginx/conf.d:/etc/nginx/conf.d
restart: always
ports:
- "80:80"
environment:
- NGINX_PORT=80
networks:
sly_net_pro:
ipv4_address: 172.172.0.1
networks:
sly_net_pro:
ipam:
driver: default
config:
- subnet: "172.172.0.0/24"
更多:
GitHub - bboysoulcn/awesome-dockercompose: 一些大家可能会经常使用的docker-compose文件
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)