/bin/sh: 1: ./configure: 未找到 - dockerfile

2023-12-20

我需要为 Apache 服务器安装 Cosign 过滤器。

我需要使用这个余弦过滤器合流 https://www.wiki.ed.ac.uk/display/EASE/Building+Cosign+Filter+for+the+Apache+Webserver+from+Source,但是当我的安装点击 ./configure 时,它​​会出现错误:

ERROR: Unknown instruction: --ENABLE-APACHE2=/PATH/TO/APACHE2/BIN/APXS

然后我发现了这个安装 http://documentation.its.umich.edu/node/596对于带有 github 存储库的 cosign 过滤器,并且因为我使用ubuntu16.04在我的 Docker 容器中,我发现它更有用,但在这个安装中我遇到了问题autoconf所以当他击中时RUN autoconf它抛出这个错误:

autoconf: error: no input file
ERROR: Service 'web' failed to build: The command '/bin/sh -c autoconf' returned a non-zero code: 1

当他击中时会发生第二个错误RUN ./configure --enable-apache2= which apx它会抛出这个错误:

Step 19/35 : RUN ./configure --enable-apache2=`which apxs`
 ---> Running in 1e9f870df22f
/bin/sh: 1: ./configure: not found
ERROR: Service 'web' failed to build: The command '/bin/sh -c ./configure --enable-apache2=`which apxs`' returned a non-zero code: 127

Dockerfile 配置:

FROM ubuntu:16.04
FROM python:3.5
ENV PYTHONUNBUFFERED 1

RUN cat /etc/passwd
RUN cat /etc/group

RUN apt-get update && apt-get install -y \
    apache2 \
    apache2-dev \
    libapache2-mod-wsgi-py3 \
    autoconf \
    libssl-dev
RUN apt-get install -y openssl
RUN mkdir /var/run/sshd

ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid

# The Umich IAM copy of Cosign includes Apache 2.4 support
RUN wget https://github.com/umich-iam/cosign/archive/master.tar.gz
RUN tar xfz master.tar.gz
RUN cd cosign-master
RUN autoconf
RUN ./configure --enable-apache2=`which apxs`
RUN make
RUN make isntall
RUN mkdir -p /var/cosign/filter
RUN chown www-data:www-data /var/cosign/filter

RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code

EXPOSE 80


# Update the default apache site with the config we created.
COPY 000-default.conf /etc/apache2/sites-enabled/000-default.conf

RUN chown -R root:www-data /var/www
RUN chmod u+rwx,g+rx,o+rx /var/www
RUN find /var/www -type d -exec chmod u+rwx,g+rx,o+rx {} +
RUN find /var/www -type f -exec chmod u+rw,g+rw,o+r {} +

#essentially: CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
CMD ["/tmp/start.sh"]

那么有没有办法解决这个问题,以便我可以安装和配置这个过滤器,谢谢。


Docker 将为每个运行一个新的容器instruction except FROM in Dockerfile, so

RUN cd cosign-master
RUN autoconf
RUN ./configure --enable-apache2=`which apxs`

三个命令将分三步执行standalone容器,所以cd cosign-master命令不能改变PWD下一个容器的环境。 您可以使用absolute path或者在 ONE 容器中执行相关命令,这意味着在 ONE 中instruction.

RUN cd cosign-master \
    && autoconf \
    && ./configure --enable-apache2=`which apxs` \
    && make \
    && make install

PS:

  1. 应该使用一个instruction执行更多命令以减少层数,因为每个instruction将生成一个新层。
  2. 应该清理intermediate文件或软件来减小最终图像的大小。

举些例子:

FROM ubuntu:16.04
FROM python:3.5

ENV PYTHONUNBUFFERED=1 \
    APACHE_RUN_USER=www-data \
    APACHE_RUN_GROUP=www-data \
    APACHE_LOG_DIR=/var/log/apache2 \
    APACHE_LOCK_DIR=/var/lock/apache2 \
    APACHE_PID_FILE=/var/run/apache2.pid

RUN set -ex \
    && cat /etc/passwd \
    && cat /etc/group \
    && apt-get update \
    && export COMPILE_TOOLS="autoconf libssl-dev openssl" \
    && apt-get install -y \
               apache2 \
               apache2-dev \
               libapache2-mod-wsgi-py3 \
               ${COMPILE_TOOLS} \
    && wget https://github.com/umich-iam/cosign/archive/master.tar.gz -O /tmp/cosign-master.tar.gz \
    && tar xfz /tmp/cosign-master.tar.gz -C=/tmp \
    && cd /tmp/cosign-master \
    && autoconf \
    && ./configure --enable-apache2=$(which apxs) \
    && make \
    && make install \
    && mkdir -p /var/cosign/filter \
    && chown www-data:www-data /var/cosign/filter \
    && apt-get purge -y ${COMPILE_TOOLS} \
    && rm -rf /var/lib/apt/lists/* \
              /tmp/cosign-master.tar.gz \
              /tmp/cosign-master/*

WORKDIR /code

# The Umich IAM copy of Cosign includes Apache 2.4 support
COPY requirements.txt /code/
COPY . /code
# Update the default apache site with the config we created.
COPY 000-default.conf /etc/apache2/sites-enabled/000-default.conf

RUN mkdir /var/run/sshd \
    && pip install -r requirements.txt \
    && chown -R root:www-data /var/www \
    && chmod u+rwx,g+rx,o+rx /var/www \
    && find /var/www -type d -exec chmod u+rwx,g+rx,o+rx {} + \
    && find /var/www -type f -exec chmod u+rw,g+rw,o+r {} +

EXPOSE 80

#essentially: CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
CMD ["/tmp/start.sh"]

这会:

  1. 减少图像的层数35只是9!
  2. 极大地减小图像的大小,也许只是one third您的原始图像。
  3. 也许有点难以阅读:)

希望这可以帮助!

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

/bin/sh: 1: ./configure: 未找到 - dockerfile 的相关文章

随机推荐