Merge branch 'change-mysql-version' of https://github.com/hackel/laradock into hackel-change-mysql-version

* 'change-mysql-version' of https://github.com/hackel/laradock:
  Add documentation on the MYSQL_VERSION variable.
  Allow specifying the version of MySQL to install in .env file.
This commit is contained in:
Mahmoud Zalt 2017-07-25 23:30:46 +03:00
commit 63816ab7d6
4 changed files with 27 additions and 4 deletions

View File

@ -158,8 +158,7 @@ You might use the `--no-cache` option if you want full rebuilding (`docker-compo
## Speed up with docker-sync ## Speed up with docker-sync
Docker for Mac is [slow](https://github.com/docker/for-mac/issues/77) due to poor performance when the application accesses files shared with the host machine. Docker on the Mac [is slow](https://github.com/docker/for-mac/issues/77), at the time of writing. Especially for larger projects, this can be a problem. The problem is [older than March 2016](https://forums.docker.com/t/file-access-in-mounted-volumes-extremely-slow-cpu-bound/8076) - as it's a such a long-running issue, we're including it in the docs here.
One solution is to use [docker-sync](https://github.com/EugenMayer/docker-sync).
In simple terms, docker-sync creates a docker container with a copy of all the application files that can be accessed very quickly from the other containers. In simple terms, docker-sync creates a docker container with a copy of all the application files that can be accessed very quickly from the other containers.
On the other hand, docker-sync runs a process on the host machine that continuously tracks and updates files changes from the host to this intermediate container. On the other hand, docker-sync runs a process on the host machine that continuously tracks and updates files changes from the host to this intermediate container.
@ -810,7 +809,7 @@ docker-compose up -d mariadb phpmyadmin
1 - Run the Adminer Container (`adminer`) with the `docker-compose up` command. Example: 1 - Run the Adminer Container (`adminer`) with the `docker-compose up` command. Example:
```bash ```bash
docker-compose up -d adminer docker-compose up -d adminer
``` ```
2 - Open your browser and visit the localhost on port **8080**: `http://localhost:8080` 2 - Open your browser and visit the localhost on port **8080**: `http://localhost:8080`
@ -1099,6 +1098,26 @@ To change the default forwarded port for ssh:
<br>
<a name="Change-the-MySQL-Version"></a>
## Change the (MySQL) Version
By default **MySQL 8.0** is running.
MySQL 8.0 is a development release. You may prefer to use the latest stable version, or an even older release. If you wish, you can change the MySQL image that is used.
Open up your .env file and set the `MYSQL_VERSION` variable to the version you would like to install.
```
MYSQL_VERSION=5.7
```
Available versions are: 5.5, 5.6, 5.7, 8.0, or latest. See https://store.docker.com/images/mysql for more information.
<br> <br>
<a name="MySQL-access-from-host"></a> <a name="MySQL-access-from-host"></a>
## MySQL access from host ## MySQL access from host

View File

@ -194,6 +194,8 @@ services:
mysql: mysql:
build: build:
context: ./mysql context: ./mysql
args:
- MYSQL_VERSION=${MYSQL_VERSION}
environment: environment:
- MYSQL_DATABASE=${MYSQL_DATABASE} - MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER} - MYSQL_USER=${MYSQL_USER}

View File

@ -92,6 +92,7 @@ PHP_SOCKET=php-fpm:9000
### MYSQL ############################################################################################################## ### MYSQL ##############################################################################################################
MYSQL_VERSION=8.0
MYSQL_DATABASE=default MYSQL_DATABASE=default
MYSQL_USER=default MYSQL_USER=default
MYSQL_PASSWORD=secret MYSQL_PASSWORD=secret

View File

@ -1,4 +1,5 @@
FROM mysql:8.0 ARG MYSQL_VERSION=8.0
FROM mysql:${MYSQL_VERSION}
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me> MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>