常用的服务的 docker-compose.yml[简单版本]docker 真的是一个好东西,非常棒 mysql1234567891011121314151617181920212223version: "3"services: db: restart: always container_name: mysql command: # 不区分大小写 --lower_case_table_names=1 --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci --explicit_defaults_for_timestamp=true # 我这里取的是mysql最新的8代版本,如果需要mysql5,就改成mysql:5.7 image: mysql environment: TZ: Asia/Shanghai # 初始密码 MYSQL_ROOT_PASSWORD: crm@8888 ports: - 3306:3306 volumes: # 映射data数据目录 - /usr/local/docker/mysql/data:/var/lib/mysql - /usr/local/docker/mysql/config:/etc/mysql/conf.d redis12345678910version: "3"services: redis: restart: always container_name: redis image: redis ports: - 6379:6379 volumes: - /usr/local/docker/redis/conf/redis.conf:/usr/local/etc/redis/redis.conf nginx1234567891011121314151617181920version: "3"services: nginx: restart: always container_name: nginx image: nginx ports: - 80:80 - 443:443 volumes: # 这里写你的nginx配置信息 - /usr/local/docker/nginx/conf.d:/etc/nginx/conf.d # 这里查看你的日志信息 - /usr/local/docker/nginx/log:/var/log/nginx - /usr/local/docker/nginx/wwww:/var/www - /usr/local/docker/nginx/etc/letsencrypt:/etc/letsencrypt # 这里存放你的静态资源文件 - /usr/local/docker/nginx/html:/usr/share/nginx/html # 这里放你需要的ssl认证文件 - /usr/local/docker/nginx/cert:/etc/nginx/cert