Dockerfile上的错误指令COPY

画中画

我正在使用Dockerfile在Docker上构建MYSQL映像。我需要帮助,因为我有此问题:无法加载身份验证插件“ caching_sha2_password”

Aman Aggarwal的解决方案适合我,但我需要在自定义my.cnf上编写它,并尝试使用它重写my.cnf默认值,但是在执行docker build时出现错误:

COPY失败:stat /var/lib/docker/tmp/docker-builder204357196/my.cnf:没有这样的文件或目录

这是我的自定义my.cnf:

# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

#
# The MySQL  Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[mysqld]
default_authentication_plugin = mysql_native_password
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql
secure-file-priv= NULL
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# Custom config should go here
!includedir /etc/mysql/conf.d/

这是我的Dockerfile:

# Indicates that the mysql image will be used as the base image.
FROM mysql

#Try copy my.cnf on this path /etc/mysql/
COPY my.cnf /etc/mysql/my.cnf

#Try only to restart mysql (not container)
RUN service mysql restart

我的文件夹结构:

proyectos(folder)
  ->build_docker
      ->Dockerfile
      ->my.cnf
西哈

Docker文档中

COPY指令从<src>路径复制新文件或目录,并将它们添加到容器的文件系统中<dest>



<dest>是一个绝对路径,或相对于WORKDIR的路径,到其中的源将在目标容器内进行复制。

您要指定目标文件名,而不是仅指定目标目录。另请注意,无需重新启动MySQL服务。该服务在容器启动时启动,而不是在构建时启动,因此您只需要:

# Indicates that the mysql image will be used as the base image.
FROM mysql

#Try copy my.cnf on this path /etc/mysql/
COPY my.cnf /etc/mysql/

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Dockerfile COPY指令失败?

Spring Boot Dockerfile错误:未知指令:JAVA

Dockerfile:$ HOME不适用于ADD / COPY指令

在dockerfile上使用COPY进行Apache构建

Dockerfile上的“ COPY。/ your / directory”是否自行复制Dockerfile?

我可以在Dockerfile中结合使用COPY指令以最小化图像层数吗?

Dockerfile ONBUILD指令

Dockerfile:了解VOLUME指令

Dockerfile来自指令

天青管道中dockerfile中copy命令中的错误路径

为什么dockerfile中的双'COPY'给出错误

来自守护程序的错误响应:Dockerfile分析错误行1:未知指令:#

在ubuntu上使用空间时Dockerfile给出错误

如何在不使用ADD或COPY指令的情况下将文件添加到Dockerfile中的映像

了解DockerFile中的“ VOLUME”指令

如果还有dockerfile指令

DockerFile 单行 vs 多行指令

Dockerfile COPY“ .env”目录

Dockerfile COPY {来源:-...}

为什么在dockerfile运行指令的/ bin / bash -c“ ...”部分中回显$ VARIABLE,却在docker build上返回空?

Dockerfile在本地生成,但在Azure Devops管道中的COPY步骤上失败

单元测试Karma Jasmine语法错误:“&”角度指令绑定上的解析错误

Dockerfile Env指令有替代方法吗?

Dockerfile中的Luigi Pipeline; 未知指令PYTHONPATH

Dockerfile VOLUME 指令清除数据

Dockerfile中的VOLUME指令的目的是什么?

openshift不遵守Dockerfile中的USER指令

未在Dockerfile的ENV指令中设置$ PWD

Dockerfile:在RUN指令中保持符号链接