新建一個(gè)文件夾
mkdir -p /usr/local/docker/apollo
vi docker-compose.yml
yml內(nèi)容(注意yml格式,對齊盡量不使用tab鍵)
配置地址
(https://github.com/ctripcorp/apollo/blob/master/scripts/docker-quick-start/docker-compose.yml)
version: '2'
services:
apollo-quick-start:
image: nobodyiam/apollo-quick-start
container_name: apollo-quick-start
depends_on:
- apollo-db
ports:
- "8080:8080"
- "8070:8070"
links:
- apollo-db
apollo-db:
image: mysql:5.7
container_name: apollo-db
environment:
TZ: Asia/Shanghai
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
depends_on:
- apollo-dbdata
ports:
- "13306:3306"
volumes:
- ./sql:/docker-entrypoint-initdb.d
volumes_from:
- apollo-dbdata
apollo-dbdata:
image: alpine:latest
container_name: apollo-dbdata
volumes:
- /var/lib/mysql
在yml目錄下執(zhí)行命令(此處只啟動了mysql,apollo需手動啟動,啟動前確保數(shù)據(jù)庫正常連接也颤,
數(shù)據(jù)庫映射端口為13306)
docker-compose up -d ./docker-compose.yml
使用數(shù)據(jù)庫連接工具連接數(shù)據(jù)庫
執(zhí)行apollo中sql文件
(https://github.com/ctripcorp/apollo/blob/master/scripts/docker-quick-start/sql/apolloconfigdb.sql)
(https://github.com/ctripcorp/apollo/blob/master/scripts/docker-quick-start/sql/apolloportaldb.sql)
導(dǎo)入執(zhí)行成功后啟動apollo
默認(rèn)登錄名:apollo 密碼:admin