WordPress.org

Make WordPress Core

#48281 closed enhancement (fixed)

Expose port 3306 of MySQL container

Reported by: ocean90 Owned by: SergeyBiryukov
Milestone: 5.4 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch
Focuses: Cc:

Description

To allow accessing the container from external the port 3306 should get exposed. This is done by defining ports in the config, see https://docs.docker.com/compose/compose-file/#ports.

To retrieve the host port you can then use docker-compose port mysql 3306.

Attachments (2)

48281.diff (312 bytes) - added by ocean90 14 months ago.
48281.2.diff (312 bytes) - added by peterwilsoncc 14 months ago.

Download all attachments as: .zip

Change History (7)

@ocean90
14 months ago

#1 follow-up: @peterwilsoncc
14 months ago

48281.2.diff accounts for users that may be exposing a database on the default port:

  • sets default to a non-standard value, 8836
  • allows users to change the port using an environment variable, similar to the local port for the web server

#2 in reply to: ↑ 1 @ocean90
14 months ago

Replying to peterwilsoncc:

48281.2.diff accounts for users that may be exposing a database on the default port:

That’s why my patch only defines the container port to allow docker-compose to choose an ephemeral host port.

#3 @donmhico
10 months ago

+1 to this. I've tested 48281.2.diff and it works. Hopefully this gets committed soon.

This ticket was mentioned in Slack in #core by david.baumwald. View the logs.


10 months ago

#5 @SergeyBiryukov
10 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 47225:

Build/Test Tools: Expose port 3306 of MySQL container.

This only defines the container port to allow docker-compose to choose an ephemeral host port.

Props ocean90, peterwilsoncc.
Fixes #48281.

Note: See TracTickets for help on using tickets.