Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
Connecting to localhost mysql server from inside docker container on macOS

How can I connect to localhost mysql server from a docker container on macOS ? One way to do it using --add-host but that requires me to pass some name like "myhost". Is there any way in macOS so that references to localhost from inside docker container actually refer to docker host ?

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

On MacOS docker provide special DNS name docker.for.mac.localhost which will resolve to the internal IP address used by the host.

about 4 years ago · Santiago Trujillo Report

0

use host.docker.internal

to connect to the host running the Docker. this works From docker version 18.03 onwards only and This is for development purposes and will not work in a production environment outside of Docker Desktop for Mac. ( refer the page https://docs.docker.com/docker-for-mac/networking/ for more info )

sample connection string for oracle, jdbc:oracle:thin:@host.docker.internal:1521/orcl

From inside of a Docker container, how do I connect to the localhost of the machine?

about 4 years ago · Santiago Trujillo Report

0

You should be able to connect to MySql running on host machine using host machine actual IP address. In MacOS, try to find your ip by command ifconfig. Mostly using IP assigned to en0 i.e. your ethernet interface should work. Just call that IP from within your container.

*localhost or 127.0.0.1 or 0.0.0.0 doesnt call host machine as they are local to container itself.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!