【问题标题】:docker chmod no such file or directorydocker chmod 没有这样的文件或目录
【发布时间】:2021-02-24 16:11:36
【问题描述】:

嗨,我需要 chmod 这个文件 /root/Desktop/folderdocker/index.php 使用 chmod 774 命令

here my dockerfile:
FROM php:7.4-cli

copy . index.php

RUN chmod -R 774 /Dekstop/folderdocker/index.php

RUN chown -R root /var/www

output:
Sending build context to Docker daemon  342.9MB
Step 1/4 : FROM php:7.4-cli
 ---> f4f453029716
Step 2/4 : copy . index.php
 ---> Using cache
 ---> bc9a68fff22f
Step 3/4 : RUN chmod -R 774 /Dekstop/folderdocker/index.php
 ---> Running in 4ddc85713576
chmod: cannot access '/Dekstop/folderdocker/index.php': No such file or directory```

【问题讨论】:

    标签: docker chmod


    【解决方案1】:

    您正在将 Dockerfile 的目录复制到映像根目录中名为 index.php 的目录中。那么你在一个不存在的路径中引用一个文件。

    确保 index.php 位于您的 Dockerfile 旁边,以便下一个命令起作用,否则您需要修改源路径。 如果路径不存在,您应该COPY index.php /some/path/or/just/root/index.php 确保运行 mkdir。然后你就可以 chown 文件了。

    为了能够看到您继承的图像,您可以运行: docker run -it php:7.4-cli sh 在其中获取 shell 并查看可用的目录。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-16
      • 1970-01-01
      • 2020-08-18
      • 1970-01-01
      • 2020-04-27
      • 2022-01-15
      • 2019-01-22
      • 2018-12-30
      相关资源
      最近更新 更多