Linux环境:centos7.6
1. 安装
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
2. 授权
chmod +x /usr/local/bin/docker-compose
3. 查看版本
docker-compose version
4. 编写docker-compose.yml至某目录下,编写内容以mysql示例:
version: "3"services:
mysql:
image: mysql:5.7
container_name: mysql_5.7
restart: always
ports:
- 3306:3306
volumes:
- ./mysql/data:/var/lib/mysql
- ./mysql/my.cnf:/etc/mysql/my.cnf
- ./mysql/logs:/logs
environment:
TZ: Asia/Shanghai
MYSQL_ROOT_PASSWORD: root@123
MYSQL_ROOT_HOST: %
logging:
driver: "json-file"
options:
max-size: "200m"
max-file: "3"
后台启动: docker-compose up -d
标签:compose,logs,Linux,uname,mysql,docker From: https://www.cnblogs.com/df-blog/p/17201253.html