How to communicate between WIN10 system and Docker internal container IP

How to communicate between WIN10 system and Docker internal container IP

1. After installing the Windows version of Docker, we start the Docker Quickstart Terminal and we will get an IP address. Mine is:

192.168.99.100

2. Start a mysql image and get the IP of this image:

At the beginning, the network is not accessible from the local machine directly to 172.17.0.2, but our local machine can reach 192.168.99.100, and 172.17.0.2 to 192.168.99.100 is also accessible. We can configure a route from the local machine to 172.17.0.2 via 192.168.99.100:

route add -p 172.17.0.0 mask 255.255.0.0 192.168.99.100

Check the route and you will see that there is a route to the 172.17.0.0 network segment.

At this time, we can ping 172.17.0.2 from our local machine. Then we use navicat to connect to the mysql container in Docker:

Additional knowledge: Bugs that occur during the use of docker

This record is about some bugs that occurred when using Docker and how I solved them. The bugs encountered when using Docker will be supplemented later.

Bug 1, verify whether nvidia-docker is installed successfully (enter the command sudo nvidia-docker run --rm nvidia/cuda nvidia-smi, the following error is generated)

lab712@lab712:~$ sudo nvidia-docker run --rm nvidia/cuda nvidia-smi

docker: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "process_linux.go:424: container init caused \"process_linux.go:407: running prestart hook 1 caused \\\"error running hook: exit status 1, stdout: , stderr: exec command: [/usr/bin/nvidia-container-cli --load-kmods configure --ldconfig=@/sbin/ldconfig.real --device=all --compute --utility --require=cuda>=10.0 brand=tesla,driver>=384,driver<385 --pid=4760 /var/lib/docker/overlay2/2b42e419162d46fad61c0a70cbb7b16c79a8878f2dab1af682dbff4813b57316/merged]\\\\nnvidia-container-cli: requirement error: unsatisfied condition: brand = tesla\\\\n\\\"\"": unknown.

Check the image files installed on your computer and find that when installing nvidia-docker, three nvidia/cuda with different tags (TAGs) were pulled, as shown in Figure 1 below. The graphics card driver is installed. Since I did not specify the nvidia/cuda tag (TAG) when using the command, the tag latest will be directly called by default.

After re-specifying the tag (TAG), enter the command: nvidia-docker run --rm nvidia/cuda:9.0-base nvidia-smi , and it will be successful. The results are shown in Figure 2.

The above article about the intercommunication method between WIN10 system and Docker internal container IP 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:
  • Solution to the Docker container being unable to access the host port
  • Docker connects to a container through a port
  • Docker uses a single image to map to multiple ports
  • Perfect solution to the problem of not being able to access the port of the docker container under Windows 10

<<:  How to display only the center of the image in the img tag in HTML (three methods)

>>:  How to encapsulate axios in Vue

Recommend

Six ways to reduce the size of Docker images

Since I started working on Vulhub in 2017, I have...

The use of v-model in vue3 components and in-depth explanation

Table of contents Use two-way binding data in v-m...

Implementation of MYSQL (telephone number, ID card) data desensitization

1. Data desensitization explanation In daily deve...

Web page html special symbols html special characters comparison table

Special symbols Named Entities Decimal encoding S...

The button has a gray border that is ugly. How to remove it?

I used the dialog in closure and drew a dialog wit...

How to use JS to check if an element is within the viewport

Preface Share two methods to monitor whether an e...

jQuery realizes the shuttle box function

This article example shares the specific code of ...

Zabbix redis automatic port discovery script returns json format

When we perform automatic discovery, there is alw...

How to build php7 with docker custom image

First, perform a simple Docker installation. To c...

Summary of the advantages of Vue3 vs. Vue2

Table of contents 1. Why do we need vue3? 2. Adva...

How to use async and await correctly in JS loops

Table of contents Overview (Loop Mode - Common) D...

CSS transparent border background-clip magic

This article mainly introduces the wonderful use ...

MySql grouping and randomly getting one piece of data from each group

Idea: Just sort randomly first and then group. 1....