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

Design Theory: Hierarchy in Design

<br />Original text: http://andymao.com/andy...

Vue echarts realizes dynamic display of bar chart

This article shares the specific code of vue echa...

MySQL 5.7.23 version installation tutorial and configuration method

It took me three hours to install MySQL myself. E...

Summary of the differences between Vue's watch, computed, and methods

Table of contents 1 Introduction 2 Basic usage 2....

Several magical uses of JS ES6 spread operator

Table of contents 1. Add attributes 2. Merge mult...

Exploring the Linux Kernel: The Secrets of Kconfig

Get a deep understanding of how the Linux configu...

10 Best Practices for Building and Maintaining Large-Scale Vue.js Projects

Table of contents 1. Use slots to make components...

Simple CSS text animation effect

Achieve results Implementation Code html <div ...

How to set MySQL foreign keys for beginners

Table of contents The role of foreign keys mysql ...

Solve the problem after adding --subnet to Docker network Create

After adding –subnet to Docker network Create, us...

vmware virtual machine ubuntu18.04 installation tutorial

Installation Steps 1. Create a virtual machine 2....

Detailed explanation of how to pass password to ssh/scp command in bash script

Install SSHPASS For most recent operating systems...

Detailed installation process of mysql5.7.21 under win10

This article shares the installation of MySQL 5.7...