不同机器及版本等环境下,docker编译nginx镜像会报错的问题

分别在如下环境下构建nginx镜像,在第一个环境下正常构建可用,第二个环境下尝试过修改dockerfile,发现不论怎么修改,报错类型都是说没有权限,没权限make没权限rm等。

报错如下:

make: make: Operation not permitted
make: *** [Makefile:8: build] Error 127
不同机器及版本等环境下,docker编译nginx镜像会报错的问题

环境如下

Linux iZuf6e64yjpwgce69u2szsZ 3.10.0-1160.11.1.el7.x86_64 #1 SMP Fri Dec 18 16:34:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Docker version 20.10.6, build 370c289

Linux agent.samhotele.com 4.16.9-1.el7.elrepo.x86_64 #1 SMP Wed May 16 13:43:43 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux
Docker version 19.03.8, build afacb8b

dockerfile如下:

FROM alpine:3.14

ADD ./soft/*.tar.gz /home/

RUN sed -i ‘s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g’ /etc/apk/repositories
&& apk update && apk upgrade && apk add make gcc g++ pcre libffi-dev libtool openssl-dev zlib-dev
&& cd /home/nginx-1.16.1 && ./configure –prefix=/etc/nginx –sbin-path=/usr/sbin/nginx –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log
–http-log-path=/var/log/nginx/access.log –lock-path=/var/run/nginx.lock –pid-path=/var/run/nginx.pid
–with-http_sub_module –with-mail –with-mail_ssl_module –with-http_stub_status_module
–with-http_ssl_module –with-http_gzip_static_module –add-module=/home/nginx-upsync-module-2.1.0
&& make && make install

ENTRYPOINT [“/usr/sbin/nginx”,”-g”,”daemon off;”]

附言 1  ·  2年前

当把 make && make install 这部分先去掉,之后exec进入容器再编译就可以了。奇怪......

附言 2  ·  2年前
讨论数量: 1

可能是权限问题

2年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!