Docker MySQL Container takes too long to initialize

Viewed 292

Once I run docker-compose up, it takes over 4 minutes for my mysql container to log out the line.

db_1       | 2021-03-09T08:29:28.459612Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.23'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.

The line is important because it is only after its respective process is finished, that I can make connections to the database.

This is my docker setup.
docker-compose.yml

version: '3.1'

services: 
  php:
    build: 
      context: .
      dockerfile: Dockerfile
    ports: 
      - 80:80
    volumes: 
      - ./src:/var/www/html
  
  db:
    image: mysql
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example

  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080

Dockerfile

FROM php:7.2-apache
RUN docker-php-ext-install mysqli

I have an i7-2600k and 16GB of ram.
I don't think my PC is potato enough to be this slow.
Any help on how I can speed up this process?

0 Answers
Related