记录一下 docker-compose 安装各个组件的 yml文件
安装 docker 和 docker-compose 就不说了
使用命令
vim docker-compose.yml
里面写入配置后,再运行
docker-compose up -d
下面说一下各个组件的 docker-compose.yml
mysql
version: '3'
services:
mysql:
restart: always
image: mysql:5.7.16
container_name: my_mysql
volumes:
- ./mydir:/mydir
- ./datadir:/var/lib/mysql
- ./conf/my.cnf:/etc/my.cnf
environment:
- "MYSQL_ROOT_PASSWORD=root"
- "TZ=Asia/Shanghai"
ports:
- 3306:3306
redis
version: '3'
services:
redis:
image: redis
restart: always
hostname: redis
container_name: redis
privileged: true
ports:
- 6379:6379
environment:
TZ: Asia/Shanghai
volumes:
- ./data:/data
- ./conf/redis.conf:/etc/redis/redis.conf
- ./logs:/logs
command: ["redis-server","/etc/redis/redis.conf"]
mongodb
version: '3'
services:
mongo:
container_name: mongo
image: mongo:4.4 # 可以修改为自己需要的版本
restart: always
ports:
- 27017:27017
volumes:
- /etc/localtime:/etc/localtime # 时区
- ./db:/data/db # 挂载数据目录
- ./log:/var/log/mongodb # 挂载日志目录
- ./config:/etc/mongo # 挂载配置目录
fafsdfs
version: "3"
services:
fastdfs-tracker:
hostname: fastdfs-tracker
container_name: fastdfs-tracker
image: season/fastdfs:1.2
network_mode: "host"
restart: always
command: tracker
volumes:
- ./tracker/data:/fastdfs/tracker/data
- ./tracker/conf:/etc/fdfs
fastdfs-storage:
hostname: fastdfs-storage
container_name: fastdfs-storage
image: season/fastdfs:1.2
network_mode: "host"
restart: always
volumes:
- ./storage/data:/fastdfs/storage/data
- ./store_path:/fastdfs/store_path
environment:
- TRACKER_SERVER=10.88.52.113:22122
command: storage
depends_on:
- fastdfs-tracker
fastdfs-nginx:
hostname: fastdfs-nginx
container_name: fastdfs-nginx
image: season/fastdfs:1.2
network_mode: "host"
restart: always
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf/nginx.conf
- ./store_path:/fastdfs/store_path
environment:
- TRACKER_SERVER=10.88.52.113:22122
command: nginx
jenkins
version: "3" # docker-compose的版本
services:
app: # 服务名称
image: jenkins/jenkins # 镜像
container_name: jenkins # 容器名
restart: always # 自动重启
environment: # 环境
TZ: Asia/Shanghai
volumes: # 数据卷
- ./jenkins_home:/var/jenkins_home
ports: # 端口映射
- "7900:8080"
- "50000:50000"