不同机器及版本等环境下,docker编译nginx镜像会报错的问题
2021-07-23 17:31:58
蓝玉
  • 访问次数: 2
  • 注册日期: 2021-07-23
  • 最后登录: 2021-07-23
分别在如下环境下构建nginx镜像,在第一个环境下正常构建可用,第二个环境下尝试过修改dockerfile,发现不论怎么修改,报错类型都是说没有权限,没权限make没权限rm等。

报错如下:

make: make: Operation not permitted
make: *** [Makefile:8: build] Error 127
![不同机器及版本等环境下,docker编译nginx镜像会报错的问题](https://cdn.learnku.com/uploads/images/202107/23/34143/rjDobAODEv.png!large)


环境如下

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;"]