Docker Community Forums

Share and learn in the Docker community.

Help needed dockerizing Apache

Hi, I am a beginner, trying to learn Docker Compose but have a problem.
I have a working stack with things like Organizr, Portainer and others.
I wanted to add a container for php:7.4-apache

I had a working standalone apache2 server, including PHP 7.4 and Let’s Encrypt certificate, so I stopped that and thought I could use the existing configurations. I added following to my compose file:

  webserver:
    container_name: webserver
    image: php:7.4-apache 
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
    volumes:
      - /var/www/domain.com:/var/www/html
      - /etc/apache2:/etc/apache2
      - /usr/lib/apache2:/usr/lib/apache2
      - ${USERDIR}/docker/apache/log:/var/log/apache2
    ports: 
      - 80:80
      - 443:443
    restart: always

I get the following error message -
apache2: Syntax error on line 146 of /etc/apache2/apache2.conf: Syntax error on line 3 of /etc/apache2/mods-enabled/php7.4.load: Cannot load /usr/lib/apache2/modules/libphp7.4.so into server: libpcre2-8.so.0: cannot open shared object file: No such file or directory

Line 3 of php7.4.load is -
LoadModule php7_module /usr/lib/apache2/modules/libphp7.4.so

/usr/lib/apache2/modules/libphp7.4 does exist.
Am I just missing something, or is it not possible what I am trying to do?