Hi guys,
We’re using “php:7.2-cli” image to build and deploy our applications to AWS ECR Fargate.
I’ve an issue, once I build and deploy the application to the ECR repository, and then I configure the task definition and service to start the container, the service fails to start the container normally and the task just go to “STOPPED” state directly with “Essential container in task exited” error.
I think there is something missing in the Dockefile for the container entry point. So, can you please help me fix this issue. Below is my php Dockerfile:
FROM php:7.2-cli
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install -y --no-install-recommends apt-utils \
&& apt-get install -y gzip git jq \
&& apt-get install -y zip unzip \
&& apt-get install -y libxml2-dev \
&& apt-get install -y openssl \
&& apt-get install -y libssl-dev libcurl4-openssl-dev pkg-config \
&& apt-get install -y libicu-dev g++ libxml2 \
&& apt-get install -y libbz2-dev zlib1g-dev
RUN docker-php-ext-install -j$(nproc) iconv \
&& docker-php-ext-install -j$(nproc) bcmath \
&& docker-php-ext-install -j$(nproc) zip \
&& docker-php-ext-install -j$(nproc) pcntl soap curl xml mbstring soap
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir -p -m 0700 /root/.ssh
EXPOSE 22
COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/
RUN chmod a+x /usr/local/bin/docker-php-ext-*
RUN chmod a+x /usr/local/bin/docker-php-entrypoint
COPY ./conf.d /usr/local/etc/php/conf.d
COPY ./php.ini /usr/local/etc/php/php.ini
ENTRYPOINT ["docker-php-entrypoint"]
CMD ["php", "-a"]
CMD ["/usr/sbin/sshd", "-D"]
Thanks,
Ali