Apache /bin/sh:1:./configure:未找到-dockerfile
我需要为Apacher服务器安装Cosign筛选器 我需要从使用此联合签名筛选器,但当我的安装命中时。/configure it trow as error:Apache /bin/sh:1:./configure:未找到-dockerfile,apache,docker,docker-compose,ubuntu-16.04,Apache,Docker,Docker Compose,Ubuntu 16.04,我需要为Apacher服务器安装Cosign筛选器 我需要从使用此联合签名筛选器,但当我的安装命中时。/configure it trow as error: ERROR: Unknown instruction: --ENABLE-APACHE2=/PATH/TO/APACHE2/BIN/APXS 然后我在github repository的cosign filter中发现了这个问题,因为我在Docker容器中使用了ubuntu16.04,我发现它更有用,但在这个安装中,我遇到了autoco
ERROR: Unknown instruction: --ENABLE-APACHE2=/PATH/TO/APACHE2/BIN/APXS
然后我在github repository的cosign filter中发现了这个问题,因为我在Docker容器中使用了ubuntu16.04
,我发现它更有用,但在这个安装中,我遇到了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
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
当他点击RUN./configure--enable-apache2=哪个apx
会出现此错误时,会出现第二个错误:
autoconf: error: no input file
ERROR: Service 'web' failed to build: The command '/bin/sh -c autoconf' returned a non-zero code: 1
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"]
因此,有没有一种方法可以修复此问题,以便安装和配置此筛选器,谢谢。Dockerd将为每个
指令运行一个新容器,除了Dockerfile
中的中的,所以
RUN cd cosign-master
RUN autoconf
RUN ./configure --enable-apache2=`which apxs`
三个命令将在三个独立的容器中执行,因此cd cosign master
命令无法更改下一个容器的PWD
环境。
您可以使用绝对路径
或在一个容器中执行相关命令,这意味着在一条指令中
RUN cd cosign-master \
&& autoconf \
&& ./configure --enable-apache2=`which apxs` \
&& make \
&& make install
附言:
应使用一条指令
执行更多命令以减少层数,因为每条指令
将生成一个新层
应清理中间文件或软件,以减小最终图像的大小
例如:
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"]
这将:
将图像的层次从大约35
减少到仅9
李>
大幅缩小图像的大小,可能仅为原始图像的三分之一
可能有点难读:)
希望这有帮助 奇怪的是,如此多的教程提倡像这里这样单独的RUN
命令:那里的教程说,“每个RUN
都是一个新的shell会话”