我们有一个用PHP创建的Web应用程序,并且我们正在使用Docker,并且将其上传到Azure容器注册表中。它运行良好,从几天开始我们就面临一个问题。有时CPU使用率很高,无法找到原因。我们已经检查了代码并在VM中运行它,没有显示任何错误,仅在使用docker时发生。
Dockerfile
FROM php:5.6-apache
RUN apt-get update
RUN apt-get -y --no-install-recommends install zlib1g-dev
RUN apt-get -y --no-install-recommends install libxml2-dev
RUN /usr/local/bin/docker-php-ext-install mysqli pdo pdo_mysql zip xmlwriter
RUN apt-get -y --no-install-recommends install libssl-dev
RUN /usr/local/bin/docker-php-ext-install zip
# Install mcrypt
RUN apt-get install -y libmcrypt-dev
RUN docker-php-ext-install mcrypt
# Install GD
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install gd
# Install XSL
RUN apt-get install -y libxslt-dev
RUN docker-php-ext-install xsl
# Install intl
RUN apt-get install -y libicu-dev
RUN pecl install intl
RUN docker-php-ext-install intl
# Install Mysql
RUN docker-php-ext-install mysql
# ffmpeg
#RUN apt-get install -y software-properties-common
#RUN add-apt-repository ppa:mc3man/trusty-media
#RUN apt-get update
RUN apt-get install -y ffmpeg
RUN apt-get install -y sendmail
RUN apt-get -y install ghostscript
COPY ./php.ini /usr/local/etc/php/
RUN { \
echo 'ServerTokens ProductOnly'; \
echo 'ServerSignature Off'; \
} >> /etc/apache2/apache2.conf
RUN service apache2 restart
COPY src/ /var/www/html/
RUN a2enmod rewrite
RUN usermod -u 1000 www-data
RUN usermod -G staff www-data