Vin*_*fer 0 docker docker-compose docker-volume ubuntu-16.04
我有以下 docker-compose.yml 文件:
version: "3"
services:
dbs-poa-loc001d:
image: percona
volumes:
- ./mysql_backup:/var/lib/mysql
- ./create_databases:/docker-entrypoint-initdb.d
hostname: "dbs-poa-loc001d"
container_name: dbs-poa-loc001d
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
ports:
- "3306:3306"
networks:
- azion-network
...
Run Code Online (Sandbox Code Playgroud)
当我尝试创建 dbs-poa-loc001d 服务(项目的数据库)时,出现以下错误:
Starting dbs-poa-loc001d ... done
Attaching to dbs-poa-loc001d
dbs-poa-loc001d | Initializing database
dbs-poa-loc001d | mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (Errcode: 13 - Permission denied)
dbs-poa-loc001d | 2019-01-11T01:17:52.060984Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
dbs-poa-loc001d | 2019-01-11T01:17:52.062286Z 0 [ERROR] --initialize specified but the data directory exists and is not writable. Aborting.
dbs-poa-loc001d | 2019-01-11T01:17:52.062299Z 0 [ERROR] Aborting
dbs-poa-loc001d |
dbs-poa-loc001d exited with code 1
Run Code Online (Sandbox Code Playgroud)
在我工作时的 MacOS 计算机上不会发生此错误,但在我的家用计算机(运行 Ubuntu 16.04)上却会发生。我确实注意到mysql_backup主机上创建的用于保存卷数据的文件夹被设置为组和用户 root。谁能告诉我发生了什么事,以及如何解决这个问题?已经尝试过但没有成功:
我当前的设置和安装的版本是:
sudo pip install docker-compose您可以尝试将权限设置mysql_backup为1001:0吗?
类似于sudo chown -R 1001:0 ./mysql_backup
或 作为替代方案,但前提是文件夹为空 sudo chmod 777 ./mysql_backup
关于percona Dockerfile mysql用户id是1001 https://github.com/percona/percona-docker/blob/master/percona-server.80/Dockerfile
| 归档时间: |
|
| 查看次数: |
9784 次 |
| 最近记录: |