Reputation: 363
I am getting myself accustomed to Docker-compose and I decided to set-up an environment for PHP/SQL/WEB, using Symfony-framework. I found this web-site to guide me on how to do it. Well, I somewhat did it, but I have encountered some hiccups:
Console log:
The MYSQL_DATABASE variable is not set. Defaulting to a blank string.
The MYSQL_ROOT_PASSWORD variable is not set. Defaulting to a blank string.
The MYSQL_ROOT_HOST variable is not set. Defaulting to a blank string.
Starting project_db_1 ... done
Starting project_php_1 ... done
Starting project_web_1 ... done
Attaching to project_db_1, project_php_1, project_web_1
db_1 | [Entrypoint] MySQL Docker Image 8.0.15-1.1.10
db_1 | [Entrypoint] Starting MySQL 8.0.15-1.1.10
db_1 | 2019-02-12T16:56:34.408593Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.15) starting as process 1
db_1 | 2019-02-12T16:56:35.798218Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
db_1 | 2019-02-12T16:56:35.811751Z 0 [ERROR] [MY-010270] [Server] Can't start server : Bind on unix socket: Operation not permitted
db_1 | 2019-02-12T16:56:35.811764Z 0 [ERROR] [MY-010258] [Server] Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ?
db_1 | 2019-02-12T16:56:35.812340Z 0 [ERROR] [MY-010119] [Server] Aborting
db_1 | 2019-02-12T16:56:37.319368Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.15) MySQL Community Server - GPL.
project_db_1 exited with code 1
The docker-compose.yml:
version: '3'
services:
php:
build: build/php
expose:
- '9000'
depends_on:
- db
volumes:
- ./:/var/www/html/symfony:cached
- ./logs:/var/log
web:
build: build/nginx
restart: always
ports:
- "81:80"
depends_on:
- php
- db
volumes:
- ./:/var/www/html/symfony:cached
- ./logs:/var/log/nginx
db:
image: mysql/mysql-server:latest
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_ROOT_HOST=${MYSQL_ROOT_HOST}
ports:
- "3307:3306"
volumes:
- ./mysql:/var/lib/mysql
The directory/file tree is as follows:
├───build
│ ├───nginx
│ │ └───sites-enabled
│ └───php
│ └───conf
├───logs
├───mysql
│ ├───#innodb_temp
│ ├───mysql
│ ├───performance_schema
│ └───sys
└───symfony
The .conf files can be found at:
Upvotes: 0
Views: 606
Reputation: 671
try this one. https://github.com/coloso/symfony-docker pretty much the same and works here really well (you need to quit the first command manually "docker-compose up --build" but everything is fine). There are also many docker problems with mysql higher than 5.7. So just use 5.7. Best Regards
Upvotes: 1