Docker executor failing for Nginx and php build

Hi I am trying to setup docker on my new system and trying to make the Laravel projects work using docker. In such a case I am trying to build an image using the following Dockerfile which would install the Nginx and the php. I am using M1 apple silicon MacBook and I am facing some issues when I am trying to build it.

My Dockerfile

FROM ubuntu:16.04


RUN apt-get update \
    && apt-get install -y locales \
    && locale-gen en_US.UTF-8

ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

RUN apt-get update \
    && apt-get install -y nginx curl zip unzip git software-properties-common supervisor \
    && add-apt-repository -y ppa:ondrej/php \
    && apt-get update \
    && apt-get install -y php7.0-fpm php7.0-cli php7.0-mcrypt php7.0-gd php7.0-mysql \
       php7.0-pgsql php7.0-imap php-memcached php7.0-mbstring php7.0-xml php7.0-curl \
       php7.0-sqlite3 php7.0-xdebug \
    && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \
    && mkdir /run/php \
    && apt-get remove -y --purge software-properties-common \
    && apt-get -y autoremove \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
    && echo "daemon off;" >> /etc/nginx/nginx.conf

RUN ln -sf /dev/stdout /var/log/nginx/access.log \
    && ln -sf /dev/stderr /var/log/nginx/error.log

COPY default /etc/nginx/sites-available/default

COPY php-fpm.conf /etc/php/7.0/fpm/php-fpm.conf

EXPOSE 80

COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

CMD ["/usr/bin/supervisord"]

I am getting the following error when I am trying to build it.

executor failed running [/bin/sh -c apt-get update     && apt-get install -y nginx curl zip unzip git software-properties-common supervisor     && add-apt-repository -y ppa:ondrej/php     && apt-get update     && apt-get install -y php7.0-fpm php7.0-cli php7.0-mcrypt php7.0-gd php7.0-mysql        php7.0-pgsql php7.0-imap php-memcached php7.0-mbstring php7.0-xml php7.0-curl        php7.0-sqlite3 php7.0-xdebug     && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer     && mkdir /run/php     && apt-get remove -y --purge software-properties-common     && apt-get -y autoremove     && apt-get clean     && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*     && echo "daemon off;" >> /etc/nginx/nginx.conf]: exit code: 100

Answer

Solution:

So to fix the problem I had to install the extensions of the php which were available. So in such a case I tried to install the extensions of php7.4 and below is the docker-compose file

version: '2'
services:
  app:
    build:
      context: ./docker/app
      dockerfile: Dockerfile
    image: ebdaa-delivery.test.com/app
    volumes:
     - .:/var/www/html
    ports:
     - "81:80"
    networks:
     - sdnet
  node:
    build:
      context: ./docker/node
      dockerfile: Dockerfile
    image: ebdaa-delivery.test.com/node
    volumes:
     - .:/var/www/html
    networks:
     - sdnet
  mysql:
    image: mariadb:10.5
    ports:
     - "3307:3306"
    environment:
      MYSQL_ROOT_PASSWORD: "root"
      MYSQL_DATABASE: "ecom"
      MYSQL_USER: "root"
      MYSQL_PASSWORD: "root"
    volumes:
     - mysqldata:/var/lib/mysql
    networks:
     - sdnet
  redis:
    image: redis:alpine
    volumes:
     - redisdata:/data
    networks:
     - sdnet
networks:
  sdnet:
    driver: "bridge"
volumes:
  mysqldata:
    driver: "local"
  redisdata:
    driver: "local"

Source