Solution Abandon the Linux virtual machine that comes with Docker for Mac (although it is lightweight, it communicates with OSX using socket files) and use docker-machine Install virtualbox. After virtualbox is created, a virtual network card will be added, which can be viewed through the ifconfig command. The way we implement it is to use this virtual network card. Use docker-machine to create a default Linux virtual machine, command docker-machine create Switch the docker environment and use the eval $(docker-machine env) command Check the IP address of the created virtual machine: docker-machine ip default or directly docker-machine ip, if it is 192.168.99.100 Execute the route command, use 192.168.99.100 as the gateway, and route the IP segment of the docker container to this IP. If the network segment of the Docker container is 172.17.0.0/16, use the sudo route -n add -net 172.17.0.0/16 192.168.99.100 command to add routing information. Start a Docker container. This test uses the redis:alpine image: docker run -d redis:alpine. Check the running mirror IP. And ping test. If nothing unexpected happens, the host machine can now ping the container. Replenish:
It will unset the DOCKER_* variables. For the record, this is the output of docker-machine env -u: unset DOCKER_TLS_VERIFY unset DOCKER_HOST unset DOCKER_CERT_PATH unset DOCKER_MACHINE_NAME Additional knowledge: Mac Docker Host mode cannot be used Today I installed fastdfs in docker on Mac, and started tracker and storage in host mode, but it didn't work. Turns out the host network driver only works with Linux hosts, and is not supported on Docker for Mac, Docker for Windows, or Docker EE for Windows Server. There is actually this limitation. Damn, a day wasted. The above article on solving the problem that docker cannot ping the host machine under Mac is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
<<: A brief discussion on the understanding of TypeScript index signatures
>>: Write a formal blog using XHTML CSS
Ubuntu16.04 install and uninstall pip Experimenta...
This article describes the MySQL single table que...
Professional web design is complex and time-consu...
Install mysql5.7.21 in the window environment. Th...
Preface At work, we often need to operate in a Li...
This article shares the specific code of Vue to i...
background The company code is provided to third ...
This article example shares the specific code of ...
Just 15 lines of CSS to crash your iPhone Securit...
Table of contents The background is: What will ha...
Table of contents 1. Modify the app.vue page 2. C...
Service.xml The Server.xml configuration file is ...
I have written many projects that require changin...
1 Download The address is: https://dev.mysql.com/...
<br />Before browsers can handle the next ge...