Automattic / Automattic/jetpack
Make Docker mysql container more accessible to the host
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
#### Is your feature request related to a problem? Please describe.
After installing the Jetpack Docker based development environment, I can't connect to the mysql container. The docs here https://github.com/Automattic/jetpack/tree/master/docker#mysql-database suggest it should be possible, however I couldn't figure out how to do it.
#### Describe the solution you'd like
I'd like to be able to connect to the mysql container from the host (macOS in my case) using the `mysql` client. To do so, the `jetpack_mysql` container needs to forward a port. I'm no Docker expert, but I was able to make this work by adding the below to the services > db section of the docker-compose.yml:
```
ports:
- "${PORT_DB:-3306}:3306"
```
After brining docker down and back up, I can now connect via:
`mysql -h 127.0.0.1 -P 3306 --user="wordpress" --password="wordpress"`
Contributor guide
Assessment
This issue has not been assessed yet.