赞
踩
文件夹目录结构如下,docker-compose安装mysql、redis、zk环境, 并初始化核心数据库配置.
version: '3' services: mysql: build: ./mysql container_name: core-db ports: - 3306:3306 environment: MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} MYSQL_ROOT_HOST: ${MYSQL_ROOT_HOST} TZ: Asia/Shanghai volumes: - "${MYSQL_DIR}/data:/var/lib/mysql" # 挂载数据目录 - "${MYSQL_DIR}/config:/etc/mysql/conf.d" # 挂载配置文件目录 redis: image: redis container_name: core-redis ports: - 6379:6379 zookeeper: image: zookeeper container_name: core-zk ports: - 2181:2181
# docker image of banking-core mysql
FROM mysql:5.7.29
MAINTAINER xxx@xxx.com
# 复制数据库初始化脚本create_table.sql到/docker-entrypoint-initdb.d文件夹下
COPY init-sql/* /docker-entrypoint-initdb.d/
[mysqld]
character-set-server=utf8mb4
default-time-zone='+8:00'
innodb_rollback_on_timeout='ON'
max_connections=500
innodb_lock_wait_timeout=500
进入core-docker目录(可将此目录放置到工作目录, 防止误删), terminal 执行命令:
$ docker-compose up -d
输出如下信息:
Creating network "core-docker_default" with the default driver
...
...
Creating core-zk ... done
Creating core-redis ... done
Creating core-db ... done
在ui终端看到core-docker服务, 可查看实例运行状态、运行日志; 重启、停止实例等.
执行cocker-compose up 出现错误信息
Creating core-db ... error
...
tcp 0.0.0.0:3306: bind: address already in use
ERROR: for mysql Cannot start service mysql: Ports are not available: listen tcp 0.0.0.0:3306: bind: address already in use
ERROR: Encountered errors while bringing up the project.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。