0

Dockerfile:

FROM php:7.4-fpm

# Install Composer
COPY --from=composer /usr/bin/composer /usr/bin/composer

# Increase composer momory limit
RUN cd /usr/local/etc/php/conf.d/ && \
  echo 'memory_limit = -1' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini

# Install unzip utility and libs needed by zip PHP extension
RUN apt-get update && apt-get install -y \
    zlib1g-dev \
    libzip-dev \
    unzip
RUN docker-php-ext-install zip

# Install missing php extensions
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

RUN chmod +x /usr/local/bin/install-php-extensions && \
    install-php-extensions gd intl pdo_mysql soap bcmath xsl zip sockets

docker-compose.yml:

version: "3.7"

services:
  web:
    image: nginx
    ports:
      - "8001:80"
    links:
      - db
      - phpfpm
    volumes: &appvolumes
      - ~/.composer:/var/www/.composer:cached
      - appdata:/var/www/html
      - sockdata:/sock
      - ssldata:/etc/nginx/certs

  phpfpm:
    build: .
    links:
      - db
    volumes: *appvolumes

  db:
    image: mariadb:10.4
    restart: always
    volumes:
      - dbdata:/var/lib/mysql
    command: --max_allowed_packet=64M
    ports:
      - "3306:3306"
    env_file: env/db.env

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    ports:
      - "8000:80"
    environment:
      - PMA_ARBITRARY=1
      - PMA_HOST=db
    depends_on:
      - db

  redis:
    image: redis:5.0-alpine

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.14.1
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      - "discovery.type=single-node"
      # Set custom heap size to avoid memory errors
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
      # Avoid test failures due to small disks
      # More info at https://github.com/markshust/docker-magento/issues/488
      - "cluster.routing.allocation.disk.threshold_enabled=false"
      - "index.blocks.read_only_allow_delete"

  rabbitmq:
    image: rabbitmq:3.8.22-management-alpine
    ports:
      - "15672:15672"
      - "5672:5672"
    volumes:
      - rabbitmqdata:/var/lib/rabbitmq



volumes:
  appdata:
  dbdata:
  rabbitmqdata:
  sockdata:
  ssldata:

At this point I can reach the Nginx welcome page via localhost:8001.

I then attached a terminal to the phpfpm container and run the Magento 2 installation commands in var/www/html:

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition magento2
cd magento2
bin/magento setup:install --admin-firstname=Admin --admin-lastname=Admin --admin-email=test@test.com --admin-user=admin --admin-password=password --base-url=http://localhost --db-host=db --db-name=magento --db-user=magento --db-password=magento --base-url-secure=https://localhost --use-secure=1 --use-secure-admin=1 --use-rewrites=1 --language=de_DE --currency=EUR --timezone=Europe/Berlin --elasticsearch-host=elasticsearch --elasticsearch-port=9200 --language=de_DE --currency=EUR

Installation runs successful. I can see the database in phpmyadmin.

But I can't reach the frontend. https://localhost:8001 and https://localhost:8001/magento2 throws this error: SSL_ERROR_RX_RECORD_TOO_LONG

Is one of these URLs even supposed to reach the frontend? Did I anything wrong or did I miss something in my setup?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.