【问题标题】:docker images alpine3.14 compile nginx 1.21.1 error,however docker images alpine3.12 is ok,why?docker images alpine3.14 compile nginx 1.21.1 报错,但是docker images alpine3.12 可以,为什么?
【发布时间】:2021-07-18 16:07:28
【问题描述】:

我尝试从 alpine:3.14 编译 docker 映像。
错误如下

make -f objs/Makefile
make: make: Operation not permitted
make: *** [Makefile:10: build] Error 127

然后切换到alpine:3.12alpine:3.13 and版本发现都OK了!

以下是我基于alpine:3.14版本编译NGINX的关键问题代码

# Omit irrelevant code

RUN  \
                addgroup  -S www  &&  adduser www  -D -S -s /bin/sh -G www  \
                && wget -P /home/soft  https://github.com/vozlt/nginx-module-vts/archive/v0.1.18.tar.gz  \
                && wget -P /home/soft  http://nginx.org/download/nginx-1.21.1.tar.gz   \
                && wget -P /home/soft  https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz    \
                &&  cd /home/soft  && tar -zxf nginx-1.21.1.tar.gz  &&  tar  -zxf  v0.1.18.tar.gz   && tar  -zxf  pcre-8.44.tar.gz  \
                &&  cd /home/soft/nginx-1.21.1  \
                &&  ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module  --with-http_v2_module --with-http_gzip_static_module --with-stream --with-http_sub_module  --with-pcre=/home/soft/pcre-8.44   --add-module=/home/soft/nginx-module-vts-0.1.18  \
                &&  make && make install  \

# Omit irrelevant code

【问题讨论】:

  • 您能否包含足够多的无关代码,以便我们重现您的错误?
  • 查看 Makefile 的相关摘录也会很有帮助。 (您可以使用 Docker Hub nginx 映像而不是自己构建吗?)

标签: docker alpine


【解决方案1】:

错误 127 7 可能意味着两件事。要么在 PATH 变量中找不到命令的二进制文件(请在此处注意,有时也可能发生命令找到但缺少某些库的情况)或二进制文件没有执行权限。看它,我怀疑是因为它没有执行权限。

我建议你运行 alpine:3.14 容器并检查 PATH 变量、make 二进制位置和权限。

【讨论】:

猜你喜欢
  • 2016-08-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-09-27
  • 1970-01-01
  • 2019-12-18
相关资源
最近更新 更多