【问题标题】:docker not unzipping my files码头工人没有解压缩我的文件
【发布时间】:2015-11-16 12:37:38
【问题描述】:

我有这个简化的 dockerfile,它应该复制 plugins/ 中的所有 .zip 文件,然后解压缩它们等等。

COPY 命令可以运行,但是没有解压,为什么?

FROM wordpress:4-fpm

# Install unzip
RUN apt-get update && apt-get install -y unzip

# Install zipped plugins, so that we don't have to manually install them.
WORKDIR /var/www/html/wp-content/plugins/
COPY ./plugins/*.zip ./
RUN unzip -q "*.zip"
RUN chown -R www-data:www-data .
RUN find . -name '*.zip' -delete

# Reset workdir
WORKDIR /var/www/html/

更新:

当我检查 docker 容器中的目录时 docker exec -it theme_wordpress_1 bash

-rw-r----- 1      501 dialout  5.3K Nov 12 08:57 acf-to-wp-api.1.3.2.zip
-rw-r----- 1 root     root     1.1M Nov 12 08:52 advanced-custom-fields.4.4.3.zip
drwxr-xr-x 4 www-data www-data 4.0K Sep 15 14:58 akismet
-rw-r--r-- 1 www-data www-data 2.3K May 22  2013 hello.php
-rw-r--r-- 1 www-data www-data   28 Jun  5  2014 index.php
-rw-r----- 1 root     root     134K Nov 12 08:57 rest-api.2.0-beta5.zip

看起来有点奇怪,即使解压缩不工作,我认为 chown 会工作,但上传的 zip 文件是由 root 拥有的。

这怎么可能?

【问题讨论】:

  • 你能在解压前试试RUN chown -R www-data:www-data .吗? (除了后面那个)

标签: wordpress docker docker-compose


【解决方案1】:

为避免通配符 (*) 被 shell 解释,请尝试将其包装在命令 shell 中:

RUN sh -c 'unzip -q "*.zip"'

【讨论】:

    猜你喜欢
    • 2017-02-01
    • 2016-04-19
    • 2021-11-18
    • 2016-01-10
    • 1970-01-01
    • 2022-07-27
    • 2010-09-05
    • 1970-01-01
    • 2018-11-06
    相关资源
    最近更新 更多