Docker win ping fails container avoidance guide

Docker win ping fails container avoidance guide

Using win docker-desktop, I want to connect to container development and try various ways on the network. kill my much time!

Bridging is not an option.

Manually adding routes doesn't work either.

So if you see this, don't think of using the conventional method to connect your Linux container using the Windows host. As of March 29, 2020

See Networking features in Docker Desktop for Windows for more information.

That is to say, bridge communication between win and linux containers is not currently supported.

However, port mapping is still possible, but it is a bit troublesome to add too many ports.

To the hours that have passed.

in addition

I can use the remote-dev of vscode on the host machine to directly access the container. I suddenly found it was great and solved my development difficulties.

Finally I can b2w, so happy

btw My computer's graphics card couldn't match tensorflow no matter how I tried, and vm didn't support graphics cards but docker did, so I ended up with win+docker+vscode as a perfect combination (and then I found out that docker-desktop currently doesn't support graphics cards for Linux:( )

Supplement: The Docker container cannot be pinged under the win10 host, and Docker creates a static IP

Workaround

Add the gateway IP of Docker to the host routing

 // CMD Administrator Mode // 172.19.0.0 is created by me, and needs to be changed according to your needs. route add 172.19.0.0/16 mask 255.255.255.0 10.0.75.2 -p // Permanent route, otherwise it will not be there after restart

win: View route print

Docker Gateway:

Docker creates a static IP

 // Docker assigns static IP addresses. You must customize your own network. The default network does not work. docker network create --subnet=172.19.0.0/16 mynet //2 to the 16th power is used. docker run -itd --name nginx2 --net mynet --ip 172.19.0.1 ubuntu 
 

The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me.

You may also be interested in:
  • Use non-root users to execute script operations in docker containers
  • Solution to the Docker container not having permission to write to the host directory
  • Solve the problem of setting Chinese language pack for Docker container
  • Solution for Docker container not recognizing fonts such as Songti
  • How to configure Jupyter notebook in Docker container
  • Docker implements container port binding local port
  • Solve the problem of the container showing Exited (0) after docker run
  • Docker uses root to enter the container

<<:  Web Design Teaching or Learning Program

>>:  Two ways to implement square div using CSS

Recommend

How React Hooks Work

Table of contents 1. React Hooks vs. Pure Functio...

Analysis and solution of Chinese garbled characters in HTML hyperlinks

A hyperlink URL in Vm needs to be concatenated wit...

How to install tomcat8 in docker

1. Install tomcat8 with docker 1. Find the tomcat...

61 Things Every Web Developer Should Know

Normally, you'll need to read everyone's s...

Detailed explanation of how a SQL statement is executed in MySQL

Overview I have recently started learning MySQL r...

Simple tutorial on using Navicat For MySQL

recommend: Navicat for MySQL 15 Registration and ...

Detailed explanation of adding dotted lines to Vue element tree controls

Table of contents 1. Achieve results 2. Implement...

Summary of MySQL usage specifications

1. InnoDB storage engine must be used It has bett...

Solution to garbled display of Linux SecureCRT

Let's take a look at the situation where Secu...

SQL Server database error 5123 solution

Because I have a database tutorial based on SQL S...

How to implement the builder pattern in Javascript

Overview The builder pattern is a relatively simp...

How to manage multiple projects on CentOS SVN server

One demand Generally speaking, a company has mult...