Am无法在Ubuntu上使用docker启动mysql。出现以下错误:
db_1_cc1214d5085c |错误:尝试检查时mysqld失败 设定db_1_cc1214d5085c |命令是:“ mysqld --verbose --help” db_1_cc1214d5085c | db_1_cc1214d5085c | mysqld:加载时出错 共享库:libpthread.so.0:无法统计共享对象: 权限被拒绝
泊坞窗组成文件的内容
version: '2.4'
services:
db:
image: mysql:5.7
ports:
- "32000:3306"
environment:
MYSQL_ROOT_PASSWORD: root
# restart: always
volumes:
- ./data/db:/var/lib/mysql
Docker详细信息:
Client:
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:48:57 2018
OS/Arch: linux/amd64
Experimental: false
服务器:Docker Engine-社区
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:16:44 2018
OS/Arch: linux/amd64
Experimental: false
还值得注意的是,在此服务器上安装并运行了MySQL的非dockerized版本。任何帮助将不胜感激。
答案 0 :(得分:2)
要启动mysql服务,您需要在docker-compose文件中包含类似的内容
version: '3'
services:
<service-name>:
image: mysql:5.7
container_name: <container-name>
ports:
- "<host-port>:<container-port>"
environment:
- MYSQL_ROOT_PASSWORD=<root-password>
- MYSQL_DATABASE=<database-name>
volumes:
- <host-dir>:/var/lib/mysql
networks: ['stack']
networks:
stack:
driver: bridge
确保<host-dir>
拥有当前执行docker-compose up
命令的用户的权限。
如果您有多个要连接到数据库的服务,则使用networks
,它们都应该消耗相同的network
,在此示例中为stack
看起来像您主机上的权限问题。