cancel
Showing results for 
Search instead for 
Did you mean: 

Problems after clean Docker installation

Problems after clean Docker installation

Hello everyone,

 

I used a Docker configuration for Magento which I found  here. I used the files in the example folder to get myself started. After finishing the installation I went to see if the CLI options are working.  They have issues:

  1. sudo bin/magento indexer:info
    
    returns
    
    [DomainException]
    Connection "default" is not defined 
  2. sudo bin/magento cache:flush
    
    returns
    
    [DomainException]
    Default website is not defined

My Dockerfile:

FROM sensson/magento2
COPY src/cron /etc/cron.d/magento2
COPY src/ /var/www/html/

My docker-compose.yml file:

 

version: '3'

services:
  mysql:
    image: mysql:5.7
    container_name: mysql
    restart: always
    volumes:
      - ./mysql:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=bS3vF3TQLXphcGxk
      - MYSQL_DATABASE=magento
      - MYSQL_USER=magento
      - MYSQL_PASSWORD=magento
    ports:
      - 3306:3306
    networks:
      - backend

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: phpmyadmin
    links:
      - "mysql:mysql"
    ports:
      - 8181:80
    environment:
      PMA_ARBITRARY: 1
      MYSQL_ROOT_PASSWORD: bS3vF3TQLXphcGxk
      MYSQL_USER: magento
      MYSQL_PASSWORD: magento
    networks:
      - backend

  frontend:
    # build has been left out on purpose. The steps to build a container
    # are not covered in the Dockerfile, they have been left out on purpose
    # so all preparation is done in an intermediate environment that has
    # all requirements. See .gitlab-ci.yml.
    build: .
    image: magento2:latest
    container_name: magento-frontend
    links:
      - "mysql:mysql"
    restart: always
    environment:
      - MYSQL_HOSTNAME=mysql
      - MYSQL_USERNAME=magento
      - MYSQL_PASSWORD=magento
      - MYSQL_DATABASE=magento
      - CRYPTO_KEY=SxKT2RyykbmbhDmh
      - URI=http://localhost:8080
      - RUNTYPE=development
      - ADMIN_USERNAME=admin
      - ADMIN_PASSWORD=adm1nistr4tor
      - ADMIN_FIRSTNAME=Your
      - ADMIN_LASTNAME=Name
      - ADMIN_EMAIL=you@yourwebsite.com
      - UNATTENDED=true
    ports:
      - 8080:80
    networks:
      - backend

networks:
  backend:
    driver: bridge

volumes:
  db:
    driver: local