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
1. Check the database time zone show variables li...
1. Create the /usr/local/services/zookeeper folde...
1. Run the .sh file You can run it directly using...
Preface In the springboot configuration file, the...
I have been working on a project recently - Budou ...
This article example shares the specific code of ...
1. Introduction Since pictures take up a lot of s...
Exploiting a newly discovered sudo vulnerability ...
The first method: dynamically add a class to show...
I have done some research on "embedding non-...
At the beginning, I felt sad. The screenshots are...
Preface In database operations, in order to effec...
Introduction Describes the use cases and solution...
Original link https://github.com/XboxYan/no… A bu...
Table of contents 1. The default focus is on the ...