Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#48281 closed enhancement (fixed)

Expose port 3306 of MySQL container

Reported by: ocean90's profile ocean90 Owned by: sergeybiryukov's profile 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 5 years ago.
48281.2.diff (312 bytes) - added by peterwilsoncc 5 years ago.

Download all attachments as: .zip

Change History (7)

@ocean90
5 years ago

#1 follow-up: @peterwilsoncc
5 years 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
5 years 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
5 years 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.


5 years ago

#5 @SergeyBiryukov
5 years 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.