1

I am trying to build a set of Docker images that includes an installation of Magento 2 and MariaDB. In rare cases it succeeds (although this could be due to small changes in the app), but in most cases it is stuck on the following:

magento2-db    | Version: '10.3.11-MariaDB-1:10.3.11+maria~bionic'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution

I see that someone else had this issue, but the cause was actual RUN commands for MariaDB installation, which I don't directly call. There doesn't seem to be anything in the log to indicate an error either.

The last lines in the log are:

[16:49:18.424][Moby           ][Info   ] [25693.252573] br-83922f7da47b: port 2(vethac51834) entered blocking state
[16:49:18.453][Moby           ][Info   ] [25693.290035] br-83922f7da47b: port 2(vethac51834) entered forwarding state
[16:49:18.637][ApiProxy       ][Info   ] time="2018-11-28T16:49:18+02:00" msg="proxy << POST /v1.25/containers/67175238f0e7a75ef527dbebbb1f5d992f1d01ee166643186dc5f727638aa66b/start (1.0560013s)\n"
[16:49:18.645][ApiProxy       ][Info   ] time="2018-11-28T16:49:18+02:00" msg="proxy >> GET /v1.25/events?filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Dmagento2%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D\n"

It seems to actually finish executing all steps in the Dockerfile, but I suspect there might be a problem in my docker-compose file, which looks like this:

version: '3.0'
services:
  app:
    build:
      context: .
      dockerfile: .docker/Dockerfile
    container_name: 'magento-2.2.6'
    ports:
      - "80:80"
    volumes:
      - magento2-test-env:/var/www/html/magento2 # will be mounted on /var/www/html
    links:
      - magento2-db
    env_file:
      - .docker/env
    depends_on:
      - magento2-db
  magento2-db:
    container_name: 'magento2-db'
    image: mariadb:latest
    ports:
      - "9809:3306"
    volumes:
      - magento2-db-data:/var/lib/mysql/data
    env_file:
      - .docker/env
volumes:
  magento2-db-data:
  magento2-test-env:
    external: true

Is there anything obviously wrong with my setup, and is there a good way to troubleshoot this, maybe look for something specific in the log?

Ynhockey
  • 3,845
  • 5
  • 33
  • 51
  • I think that log means good to go. what are you expecting – Siyu Nov 28 '18 at 16:39
  • why do you say it's an "installation"? – Siyu Nov 28 '18 at 16:40
  • @Siyu When it works it finishes this MariaDB flow and performs some action (which I don't fully understand, I wasn't able to inspect it) that properly attaches the database to the server (or maybe copies the DB). What happens is that the resulting container doesn't have a /var/lib/mysql folder at all, let alone any of the expected data, and no mysqld. When it works `magento2-db` is correctly attached. – Ynhockey Nov 28 '18 at 16:53
  • can't help you as i seem to have the some problem running the official image – Siyu Nov 28 '18 at 17:23

2 Answers2

0

maybe the way you're building your composer what's the problem.

Try use this one:

version: '3.0'
services:
  app:
    build:
      context: .
      dockerfile: .docker/Dockerfile
    container_name: 'magento-2.2.6'
    ports:
      - "80:80"
    volumes:
      - magento2-test-env:/var/www/html/magento2 # will be mounted on /var/www/html
    links:
      - magento2-db
    env_file:
      - .docker/env
    depends_on:
      - db
  db:
    container_name: 'magento2-db'
    image: mariadb:latest
    ports:
      - "9809:3306"
    volumes:
      - /var/lib/mysql/data
    env_file:
      - .docker/env
volumes:
  magento2-db-data:
  magento2-test-env:
    external: true

Avoid to use services names like 'blabla-something' if you need put a name use as container_name it'll be enough, and the db, links always should links in the services itself no in the containers name.

I hope this could help you.

0

Try setting -e MYSQL_INITDB_SKIP_TZINFO=1, refer to this issue.

e.g.

docker run -it --rm -e MYSQL_INITDB_SKIP_TZINFO=1 ... mariadb:10.4.8
Zstack
  • 4,046
  • 1
  • 19
  • 22