Docker cannot access mysql in the container through the host ip

  docker, question

As shown in the figure

The setting here should be to map the 3306 of the container to the 3366 of the host, but I can only connect mysql services in the container through 3366

The real ip of my host is

But I couldn’t connect it through 3366, and asked the great god for advice.



Answer your question directly:
The reason why you have to pass192.168.99.100:3366To access the IP of the container instead of the host: used itToolbox, andToolboxIt is used by default.VirtualboxVirtual machines, so one more layer.

Drawing instructions:

@ ClearWhat you said is also right. I suggest you use it.Docker for Mac,ToolboxWill be gradually abandoned.