Rather than having the MySQL database in Docker, or in a separate volume, I'd like Docker to connect to my pre-existing MySQL database I have running locally.
I'm using Laravel, hence the environment variables.
Can anyone help?
This is my docker-compose.yml file:
version: '2'
services:
web:
image: nginx:latest
ports:
- "8080:80"
volumes:
- .:/code
- .docker/nginx.conf:/etc/nginx/conf.d/default.conf
php:
build:
context: .
dockerfile: .docker/Dockerfile
image: php:7-fpm
volumes:
- .:/code
environment:
DB_CONNECTION: mysql
DB_PORT: 3306
DB_HOST: mysql
DB_DATABASE: website_development
DB_USERNAME: website_username
DB_PASSWORD: website_pA$£w0r6
REDIS_HOST: redis
SESSION_DRIVER: redis
CACHE_DRIVER: redis
mysql:
image: mysql:5.7
ports:
- 13306:3306
environment:
MYSQL_DATABASE: website_development
MYSQL_USER: website_username
MYSQL_PASSWORD: website_pA$£w0r6
MYSQL_ROOT_PASSWORD: root_pA$£w0r6
redis:
image: redis:4.0-alpine
ports:
- 16379:6379