老师你好,我照着老师的命令在master虚拟机中进行输入,却启动不了容器。查看提示如下:
[root@localhost mysql]#
[root@localhost mysql]# docker run \
> --name mysql57 \
> -p 3306:3306 \
> -v /opt/mysql/data:/var/lib/mysql \
> -v /opt/mysql/log:/var/log/mysql \
> -v /opt/mysql/my.cnf:/etc/mysql/my.cnf:rw \
> -e MYSQL_ROOT_PASSWORD=password \
> -d registry.cn-beijing.aliyuncs.com/qingfeng666/mysql:5.7 --default-authentication-plugin=mysql_native_password
ad58dbba1be8b116e427fd476c67ea493aa180b029c5194f02602fa0f863077e
[root@localhost mysql]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@localhost mysql]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ad58dbba1be8 registry.cn-beijing.aliyuncs.com/qingfeng666/mysql:5.7 "docker-entrypoint..." 4 seconds ago Exited (1) 4 seconds ago mysql57
[root@localhost mysql]# docker logs ad58dbba1be8
2021-03-21 05:40:19+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.32-1debian10 started.
chown: changing ownership of '/var/lib/mysql/': Permission denied
[root@localhost mysql]#
我在执行老师命令的时候,后面加上 /bin/bash -c ‘chmod -R 777 /var/lib/mysql’ 也不行
如下:
docker run \
--name mysql57 \
-p 3306:3306 \
-v /opt/mysql/data:/var/lib/mysql \
-v /opt/mysql/log:/var/log/mysql \
-v /opt/mysql/my.cnf:/etc/mysql/my.cnf:rw \
-e MYSQL_ROOT_PASSWORD=password \
-d registry.cn-beijing.aliyuncs.com/qingfeng666/mysql:5.7 --default-authentication-plugin=mysql_native_password \
/bin/bash -c 'chmod -R 777 /var/lib/mysql
然后提示报错
[root@localhost ~]# docker logs 37209e3ee3ac
2021-03-21 06:52:28+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.32-1debian10 started.
2021-03-21 06:52:28+00:00 [ERROR] [Entrypoint]: mysqld failed while attempting to check config
command was: mysqld --default-authentication-plugin=mysql_native_password /bin/bash -c chmod -R 777 /var/lib/mysql --verbose --help
2021-03-21T06:52:28.215413Z 0 [ERROR] mysqld: unknown option '-c'
2021-03-21T06:52:28.218348Z 0 [ERROR] Aborting