类似于ansible剧本 yml 格式
要使用这个编排工具,必须先安装
yum install -y docker-compose
cd wordpress/
vi docker-compose.yml
###############
version: '3'
services:
db:
image: mysql:5.7
volumes:
- /data/db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- db
image: wordpress:latest
volumes:
- /data/web_data:/var/www/html
ports:
- "80:80"
restart: always
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
###############
在含有docker-compose.yml的目录下执行
docker-compose up -d
访问网页,检查
使用docker-compose编排方式,安装zabbix
vim docker-compose.yml
################
version: '3'
services:
mysql-server:
image: mysql:5.7
restart: always
command: --character-set-server=utf8 --collation-server=utf8_bin
environment:
MYSQL_ROOT_PASSWORD: root_pwd
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: zabbix_pwd
zabbix-java-gateway:
image: zabbix/zabbix-java-gateway:latest
restart: always
zabbix-server:
depends_on:
- mysql-server
- zabbix-java-gateway
image: zabbix/zabbix-server-mysql:latest
ports:
- "10051:10051"
restart: always
environment:
DB_SERVER_HOST: mysql-server
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: zabbix_pwd
MYSQL_ROOT_PASSWORD: root_pwd
ZBX_JAVAGATEWAY: zabbix-java-gateway
zabbix-web:
depends_on:
- mysql-server
- zabbix-server
image: zabbix/zabbix-web-nginx-mysql:latest
ports:
- "80:80"
restart: always
environment:
DB_SERVER_HOST: mysql-server
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: zabbix_pwd
MYSQL_ROOT_PASSWORD: root_pwd
################
在含有docker-compose.yml的目录下执行
docker-compose up -d
访问网页,检查
原文地址:https://www.cnblogs.com/yangxiaoni/p/11991878.html
时间: 2024-10-07 09:01:44