docker-compose -f xxx.yml up
version: "3"
services:
redis1:
image: 'redis'
ports:
- '6389:6379'
mysql1:
image: 'mysql:5.7'
restart: always
container_name: mysql-5.7
ports:
- '3316:3306'
volumes:
- ./mysql/mydir:/mydir
- ./mysql/datadir:/var/lib/mysql
- ./mysql/conf/my.cnf:/etc/my.cnf
# 数据库还原目录 可将需要还原的sql文件放在这里
- ./mysql/source:/docker-entrypoint-initdb.d
environment:
- "MYSQL_ROOT_PASSWORD=123456"
- "TZ=Asia/Shanghai"
mongo1:
image: 'mongo'
ports:
- '27027:27017'
kafka1:
image: 'bitnami/kafka:3.1.0'
ports:
- '9091:9091'
environment:
- KAFKA_BROKER_ID=1
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9091
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka1:9091
- ALLOW_PLAINTEXT_LISTENER=yes
标签:compose,image,9091,例子,mysql,docker,ports
From: https://www.cnblogs.com/Asuphy/p/17503794.html