/bin/sh:1:./configure:找不到-dockerfile [英] /bin/sh: 1: ./configure: not found - dockerfile
问题描述
我需要为Apacher服务器安装Cosign过滤器.
I need to install Cosign filter for Apacher server.
I need to use this cosign-filter from Confluence, but when my installation hits ./configure it trow as error:
ERROR: Unknown instruction: --ENABLE-APACHE2=/PATH/TO/APACHE2/BIN/APXS
然后我发现此安装用于与github存储库共同签名过滤,这是因为我在我的Docker容器中使用ubuntu16.04
时,我发现它更有用,但是在此安装中,我遇到了autoconf
的问题,因此当他按下RUN autoconf
时,它将引发以下错误:
Then i found out this installation for cosign filter with github repository, and because I use ubuntu16.04
in my Docker container I found it more useful, but in this installation I have a problem with autoconf
so when he hits RUN autoconf
it trows this error:
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
时将发生第二个错误,它将引发该错误:
Second error will happen when he hits RUN ./configure --enable-apache2= which apx
it will trow this error:
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配置:
Dockerfile configuration:
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"]
有什么办法可以解决此问题,谢谢,我可以安装和配置此过滤器.
So is there a way I can fix this so I can install and configure this filter, thanks.
推荐答案
Dockerd将为Dockerfile
中除FROM
之外的每个instruction
运行一个新容器,因此
Dockerd will run a new container for every 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
或在一个容器中执行关联的命令,这意味着在一个instruction
中.
three commands will be executed in three standalone
containers, so cd cosign-master
command can NOT change the PWD
environment for next containers.
You can use the absolute path
or execute the associated commands in ONE container, which means in ONE instruction
.
RUN cd cosign-master \
&& autoconf \
&& ./configure --enable-apache2=`which apxs` \
&& make \
&& make install
PS:
- 应该使用一个
instruction
执行更多命令以减少层数,因为每个instruction
都会生成一个新层. - 应清理
intermediate
文件或软件,以减小最终图像的大小.
- should use one
instruction
to execute more commands to reduce the number of layers, because eachinstruction
will generate a new layer. - should clean up the
intermediate
files or softwares to reduce the size of final image.
例如:
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
! - 极大地减小图像的大小,也许只是原始图像的
one third
. - 也许有点难以理解:)
- reduce layers of your image from about
35
to just9
! - reduce the size of your image immensely, maybe only
one third
of your origin image. - maybe a little difficult to read :)
希望这会有所帮助!
这篇关于/bin/sh:1:./configure:找不到-dockerfile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!