通过网盘分享的文件:docker-images
链接: https://pan.baidu.com/s/1qyidkCeGg0O_3odSG5jstA 提取码: sduq
compose.yml文件
version : '3.8'
networks:
bbs-networks:
name: bbs-networks
driver: bridge
services:
bbs-mysql:
container_name: bbs-mysql
image: mysql:8.0.32
build:
context: ./mysql
dockerfile: dockerfile
ports: #不需要对外管理或者使用的话,就不需要映射端口
- "13309:3306"
volumes:
- ./mysql/conf:/etc/mysql/conf.d
- ./mysql/logs:/logs
- ./mysql/data:/var/lib/mysql
- /etc/localtime:/etc/localtime
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'
]
environment:
MYSQL_DATABASE: bbs
MYSQL_ROOT_PASSWORD: bbs@2023
MYSQL_USER: bbs
MYSQL_PASSWORD: bbs@2023
TZ: Asia/Shanghai
#privileged: true
networks:
- bbs-networks
restart: always
bbs-redis:
container_name: bbs-redis
image: redis:7.0.10
environment:
- TZ=Asia/Shanghai
volumes:
- ./redis/conf/redis.conf:/home/redis/redis.conf
- ./redis/data:/data
- /etc/localtime:/etc/localtime
networks:
- bbs-networks
command: redis-server /home/redis/redis.conf
restart: unless-stopped
bbs-php:
container_name: bbs-php
image: registry.cn-hangzhou.aliyuncs.com/cqcqs/php-fpm:8.2
build:
context: ./php
dockerfile: dockerfile
#ports:
# - "9001:9000"
volumes:
- ./www:/var/www
- ./php/php.ini:/usr/local/etc/php/php.ini
- ./php/php-fpm.conf:/usr/local/etc/php-fpm.d/www.conf
- /etc/localtime:/etc/localtime
depends_on:
- bbs-mysql
- bbs-redis
links:
- "bbs-mysql:mysql"
- "bbs-redis:redis"
networks:
- bbs-networks
restart: always
nginx:
container_name: bbs-nginx
image: nginx
build:
context: ./nginx
dockerfile: dockerfile
ports:
- "8081:80"
environment:
TZ: Asia/Shanghai
volumes:
- ./www:/var/www
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/logs:/var/log/nginx
- ./nginx/conf.d:/etc/nginx/conf.d
- /etc/localtime:/etc/localtime
depends_on:
- bbs-php
links:
- "bbs-php:php"
networks:
- bbs-networks
restart: always
下载源码,放到 docker-bbs/www里面,执行
docker-compose up -d