Automattic / Automattic/jetpack

Make Docker mysql container more accessible to the host

Open
#16,483 1 comment 0 reactions 1 assignee Claimed by @kraftbj View on GitHub
[Status] In Progress Docker Enhancement
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.